Ruby is supposed to be slicker, faster, and easier web-programming than everything else out there. At work, we are hoping that’s true and are building our next-gen product on it.
gem command cheat sheet: http://docs.rubygems.org/read/chapter/10.
I’ll start with Aptana RadRails for 3 primary reasons:
- It’s free
- It’s part of eclipse and so the editor learning curve isn’t steep.
- Upon opening, it prompted for common gems I might like to install
The book’s examples use SQLite, but we’re an oracle house. The book does provide a link to oci8 ruby gems for oracle but after reading warnings about building dirvers and having ito install visual C++ to do it, I thought this would be too long of a path to go down. So, I just tried the command:
As you can tell, it ran just fine.
Parenthesis, case-sensitivity, and quotes
You can still use parenthesis in method calls, but they are generally optional. I’m sure this will force me to read ruby code 2 or 3 times before i figure out what it’s doing.
Class names, module names, and constants must start with an uppercase letter. WTF?
Single quotes and double quotes are interpreted differently – for strings in double quotes, you can perform regex like code.
Oh – and not null, nil
Methods that have “self.” before it (ex: self.get_id) can be used in the entire application (global).
Methods with “protected” above their declaration can be called by other instances & the same instance of the same class.
Methods with “private” above their declaration can be only called within the same instance of the same class.
Instance variables (those with “@” before them; ex: @id) are not accessible outside the class. You have to write getter/setter methods for them. This is easy in Ruby: