Everything is an object or object-oriented in Ruby. : Object in Ruby « Class « Ruby






Everything is an object or object-oriented in Ruby.


# the expression 1.+ is simply calling the + method of the 1 object

puts 1.+(2)

 








Related examples in the same category

1.abs absolute value method
2.All strings in Ruby are objects of the String class, as you can discover by calling a string's class method
3.Get the modules Object class belongs to