Module | OpenStructable |
In: |
lib/more/facets/ostructable.rb
|
OpensStructable is a mixin module which can provide OpenStruct behavior to any class or object. OpenStructable allows extention of data objects with arbitrary attributes.
require 'ostructable' class Record include OpenStructable end record = Record.new record.name = "John Smith" record.age = 70 record.pension = 300 puts record.name # -> "John Smith" puts record.address # -> nil