Installation of Ruby
Pay attention.
- OS X or Linux is better
- Implementation of different versions: C + +, C, Java
- This time C Ruby
Installation method
- Linux or OS X has pre-installed
- Package Manager (APT, yum, Brew), not the latest
- Version control system: RVM (Rvm.io), rbenv
Rvm
- View Ruby version
Installation
Help
RVM--help
User manual: Man RVM
Rbenv
- Install with brew under OS X
Windows install via Rubyinstaller
Learning materials
Tools
Deploy platform Linux under
Common installation Method: source code compilation, step
- Download and unzip the website
- ./config
- Make
- Make install to the path
- Ruby-v View Version
Ruby's Run
Two ways:
Interactive:
1. Use Ruby command: Ruby
2.irb:irb
Writing Program Files (. RB)
1. Save the program in a file and use the ruby command to
Vim hello.rb
puts "Hello world"
def Hello (name)
puts "Hello #{name}"
End
Hello (' mac ')
Ruby Hello.rb
Ruby's Document System
RDOC: Document Generation Tool
Ri: Reading RDOC documents
RI Mina
ri--serve Browser Browse documentation//localhost:8214