Ruby/Class/Object in Ruby
Материал из Wiki.crossplatform.ru
(Различия между версиями)
ViGOur (Обсуждение | вклад) м (1 версия: Импорт выборки материалов по Ruby) |
Текущая версия на 17:55, 13 сентября 2010
Содержание |
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]