Ruby/File Directory/subclass File

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

(Различия между версиями)
Перейти к: навигация, поиск
м (1 версия: Импорт выборки материалов по Ruby)
 

Текущая версия на 17:57, 13 сентября 2010

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."