TAILIEUCHUNG - Ruby for Rails phần 2

Ruby có 2 bản hiện thực chính: bộ thông dịch Ruby chính thức, bản được dùng phổ biến nhất, và JRuby, bản hiện thực dựa trên ngôn ngữ Java. Bộ thông dịch Ruby đã được hiện thực trên nhiều platforms khác nhau, bao gồm Unix, Microsoft Windows, DOS, Mac OS X, OS/2, Amiga và một số khác. Bản chính thức của Ruby có kèm theo "IRB", là bộ thông dịch dạng dòng lệnh trực tiếp (interactive command-line interpreter) giúp cho việc kiểm tra code nhanh chóng | 16 CHAPTER 1 How Ruby works As already noted when you run a Ruby program you re really running a program called ruby and feeding your program to that program. Here we ll look at further options available to you in the course of doing this. These options include command-line switches of which you ve seen an example in the -cw syntax-checking flag techniques for directing your program to the Ruby interpreter without having to invoke ruby on the command line and details of how to run the irb interpreter. Command-line switches When you start the Ruby interpreter from the command line you can provide not only the name of a program file but also one or more command-line switches. The switches you choose instruct the interpreter to behave in particular ways and or take particular actions. Ruby has more than 20 command-line switches. Some of them are used rarely others are used every day by many Ruby programmers. Here we ll look at several more of the most commonly used ones. You ve already seen two of them -c and -w used in combination with each other. These common switches are summarized in table and then explained separately. Table Summary of commonly used Ruby command-line switches Switch Description Example of usage -c Check the syntax of a program file without executing the program ruby -c -w Give warning messages during program execution ruby -w -e Execute the code provided in quotation marks on the command line ruby -e puts Code demo -v Show Ruby version information and execute the program in verbose mode ruby -v -l Line mode print a newline after every line if not otherwise present ruby -l -e print Will jump down -rname Load the named extension require it ruby -rprofile --version Show Ruby version information ruby --version Check syntax -c The -c switch tells Ruby to check the code in one or more files for syntactical accuracy without executing the code. It s usually used in conjunction with the -w flag. Techniques of interpreter .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.