Ruby Introduction
Ruby was written in and released in 95. It is an object-oriented programming scripting language.ProgramMember. Despite the recent surge in the suppression of Japanese goods, here I would like to cite Mr. Song benhong's insight into program development: program development itself is a mental labor, and in essence it is actually a kind of sports, similar to competitions such as chess and go games. Therefore, we must treat our work and our counterparts in the spirit of the Olympics. Our work is to serve all mankind and is politically independent.
Ruby is named after Ruby, The birthpoint of July. Then I had a little bit of the birthpoint of April, So I smiled. Ruby has the advantage of simple syntax and is better at agile development. Currently, Ruby on Rails is a ruby-based Agile development framework. With the in-depth understanding of Ruby, we believe we will have a deeper understanding of these features.
Obtain Ruby and related information
1. Obtain the ruby official website from the ruby official website.
2. obtain from the rubyinstaller Website: Official rubyinstaller website
3. Ruby ChineseCommunity: Ruby China official website
We recommend that you download the latest Ruby installation package and API documentation from the official rubyinstaller website.
Ruby Installation
After obtaining the latest Ruby installation package, double-click to run the installation package. The following page is displayed:
Select the following three options. Option 1 allows us to create a graphic interface application. Option 2 adds the executable file path of Ruby to the path environment variable; option 3 associate the files with the extension Rb and rbw with the currently installed Ruby version.
Click Install to complete the installation.
After the installation is complete, choose Start> RUN> Enter cmd and enter ruby-V in the command line to view the current Ruby version:
So far, the ruby installation is complete, isn't it very easy (pai_^ ).
Execute Ruby
And othersProgramming LanguageSimilarly, we should first create a helloruby demo. Create a text file and enter the following content:
Print ("Hello, Ruby! \ N");
Save the file as helloruby. RB. Then we can use the CD command to move to the directory where helloruby. Rb is located, and then type the file name. The effect is as follows:
What, I don't know how to use the CD command? Well, let's use the GUI editor to execute the above operations.
Build rubymine Development Environment
Rubymine is a graphic interface editor developed by jetbrains for Ruby development. It adheres to the rigorous and consistent style of European programmers. This editor is powerful and easy to operate, it is very helpful for us to learn the ruby language.
1. Obtain rubymine
Get the link from the jetbrains Official Website: rubymine Official Website
2. Install rubymine
The installation process is the same as the actual software.
3. Configure rubymine so that it can interpret the ruby File
Open the main interface of rubymine, create a helloworld project, add the helloworld. RB file, and enter:
Print ("Hello, Ruby! \ N");
And save. Find the option shortcut menu in the toolbar:
Click options. In the displayed session window, select the [ruby sdk and gems] option. In the [Ruby interpreter] option on the right, select [add sdkscripts, navigate to the ruby installation directory, and find the ruby.exe executable file, click OK to complete the settings.
Now, you can use the editor to program Ruby.
Run the previously saved Ruby file and click the run button (green triangle) in the toolbar. The result is shown as follows:
Note here to output Chinese words, the header of this sentence [# encoding: uft-8] should not be less, and in order to avoid Chinese characters not converted to UTF-8 encoding, be sure to use puts output.
The part for setting up the ruby development environment is mentioned here. The layout is not very good. Sorry. The layout of fish-li in the garden is very standard and neat, and the navigation and content layout of each article are orderly. I have asked questions today to know that they are only produced by handwriting HTML. Those who write technology in this meticulous way are admirable. He is an example of our learning.