Class | OpenStruct |
In: |
lib/facet/ostruct/ostruct_update.rb
lib/facet/ostruct/[].rb |
Parent: | Object |
Access a value in the OpenStruct by key, like a Hash. This increases OpenStruct’s "duckiness".
require 'facet/ostruct/[]' o = OpenStruct.new o.t = 4 o['t'] #=> 4
Set a value in the OpenStruct by key, like a Hash.
require 'facet/ostruct/[]' o = OpenStruct.new o['t'] = 4 o.t #=> 4