Class OpenStruct
In: lib/facet/ostruct/ostruct_update.rb
lib/facet/ostruct/[].rb
Parent: Object

Methods

[]   []=   ostruct_update  

Public Instance methods

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

Insert/update hash data on the fly.

  require 'facet/ostruct/ostruct_update'

  o = OpenStruct.new
  o.ostruct_update { :a => 2 }
  o.a  #=> 2

[Validate]