Ruby/File Directory/subclass File

Материал из Wiki.crossplatform.ru

Версия от 17:57, 13 сентября 2010; ViGOur (Обсуждение | вклад)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Extends File class and add new method

class MyFile < File
  def MyFile.ftype(*args)
    return "The type is #{super}."
  end
end
File.ftype("/bin")                        # => "directory"
puts MyFile.ftype("/bin")                      # => "The type is directory."