Ruby Quick Reference
Written on March 22, 2008 by ceefour
While using Ruby for your projects, you may need some references.
These are some references that might help you in using Ruby:
- Language
- Comments start with a pound/sharp (#) character and go to EOL.
- Ruby programs are sequence of expressions.
- Each expression is delimited by semicolons(;) or newlines unless obviously incomplete (e.g. trailing ‘+’).
- Backslashes at the end of line does not terminate expression.
alias and BEGIN begin break case class def defined do else elsif END end ensure false for if in module next nil not or redo rescue retry return self super then true undef unless until when while yieldBasic types are numbers, strings, ranges, regexen, symbols, arrays, and hashes. Also included are files because they are used so often.
$global_variable @@class_variable @instance_variable [OtherClass::]CONSTANT local_variable
- Standard Library
Ruby comes with an extensive library of classes and modules. Some are built-in, and some are part of the standard library. You can distinguish the two by the fact that the built-in classes are in fact, built-in. There are no dot-rb files for them.
Class Hierarchy:
Object
- Hash
- Symbol
- IO
- File
- Continuation
- File::Stat
- Data
- NilClass
- Exception (see tree above)
- Array
- Proc
- String
The essentials:
- benchmark.rb a simple benchmarking utility
- cgi-lib.rb decode CGI data - simpler than cgi.rb
- cgi.rb CGI interaction
- date.rb date object (compatible)
- debug.rb ruby debugger
- delegate.rb delegate messages to other object
- English.rb access global variables by english names
- fileutils.rb file utility methods for copying, moving, removing, etc.
- Tools: ruby(Command Line Options, Environment Variables), irb, xmp, ruby-mode, Debugger, rdoc
- Mindshare, Idiom and Patterns (Object Design, Other Third-party Libraries)
For further details visit Ruby Quick Reference page at ZenSpider.
If you enjoyed this post Subscribe to our feed

Add New Comment
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks
(Trackback URL)