Ruby/Class/OpenStruct
Материал из Wiki.crossplatform.ru
Версия от 17:55, 13 сентября 2010; ViGOur (Обсуждение | вклад)
OpenStruct class provided by the ostruct library makes it even easier.
# Create data objects without specifying the attributes # Create attributes on the fly: require "ostruct" person = OpenStruct.new person.name = "Tom" person.age = 25