setting up IRB and RI
Enter ruby-v to see if the Ruby version can be displayed
Now you can
ConfigurationIrbthe.
IRB is an interactive Ruby command-line tool that executes and gives results as soon as you enter a sentence .
The default IRB is not strong enough to configure it now .
IrbConfiguration
In the. IRBRC file ( file path :%USERPROFILE%\.IRBRC) that is placed in the personal directory .
Resource Manager > Address bar > input %userprofile%>shift+ Right-click > Open a command-line window
configuration file does not exist by default , you need to create a new one , enter it inside
# This is the IRB configuration file , and the IRB will read the configuration of this file before it runs .
# This file needs to be in the user directory
Require 'irb/completion' # turn on auto-completion
Irb.conf[:auto_indent]=true # turn on auto indent feature
* * Note : do not include Chinese notes.
Experience
Now you can open the ruby Interactive tool by entering IRB on the command line to experience the AutoComplete feature and auto indent .
For example :
input File.me, then press the tab key to automatically complete the function name Input and become File.method.
If you find more than one possibility , it won't be done automatically , but pressing TAB twice will show all possible names .
As for indentation, for example, enter def FUN1, then press enter, and the next line will indent two spaces for you to type in.
Next is Ri,ri is the tool for viewing help at the terminal , and if you prefer to use CHM, then the configuration will not need to be set up.
Ruby 's Help file is in Ruby\doc\ruby20.chm.
If you also want to try using the terminal to see the Help , then continue looking down .
First you need to installRiformat Help file
1. Run the Gem install rdoc-data installation at the terminal
2. then you need to generate ri data to run at the terminal
Rdoc-data-install
Gem RDoc--all--overwrite
3. you can now use RIS to query , such as the use of the Strip method to query String.
running at Terminal : Ri string#strip
It then outputs :
(from Ruby Core)
——————————————————————————
Str.strip-New_str
——————————————————————————
Returns a copy of STR with leading and trailing whitespace removed.
" hello". Strip #=> "Hello"
"\tgoodbye\r\n". Strip #=> "Goodbye"
Setting up IRB and RI