Ruby On Rails
Saturday, October 15, 2011
Checking for pallindrome in ruby
›
Non-recursive def is_palindrome ( s ) s == s. reverse end Recursive def is_palindrome_r ( s ) if s. length < = 1 true els...
Converting between values and char
›
// character to ASCII value: use ? ?a # => 97 ?\n # => 10 // string to integer: use [] ' a '[ 0 ] # => 97 ...
Friday, October 14, 2011
Ruby from perspective of other programming languages
›
Don't confuse object attributes and local variables. If you are accustomed to C++ or Java, you might forget this. The variable @my_var...
Primary types in Ruby
›
Character A character in Ruby truly is an integer. It is not a type of its own, as in Pascal, and is not the same as a string of length 1 ...
Comparison of operators with c or other languages
›
Many of Ruby's operators are similar or identical to those in C. Two notable exceptions are the increment and decrement operators ( ++...
Things to remember for ruby
›
The Ruby parser is complex and relatively forgiving. It tries to make sense out of what it finds instead of forcing the programmer into sl...
Thursday, October 13, 2011
Methods and attributes
›
As we've seen, methods are typically used with simple class instances and variables by separating the receiver from the method with a p...
›
Home
View web version