Ruby/Class/Object in Ruby
Материал из Wiki.crossplatform.ru
Содержание |
abs absolute value method
puts -1.abs
All strings in Ruby are objects of the String class, as you can discover by calling a string"s class method
puts "Hello, world!".class
Everything is an object or object-oriented in Ruby.
# the expression 1.+ is simply calling the + method of the 1 object puts 1.+(2)
Get the modules Object class belongs to
p Object.included_modules # => [Kernel]