Class | OpenStruct
In: | lib/facets/core/ostruct/instance_delegate.rb lib/facets/core/ostruct/__update__.rb lib/facets/core/ostruct/__table__.rb lib/facets/core/ostruct/op_fetch.rb lib/facets/core/ostruct/to_h.rb
Parent: | Object

### Methods

[] []= __merge__ __table__ __update__ instance_delegate to_h

### Public Instance methods

[](key)

Access a value in the OpenStruct by key, like a Hash. This increases OpenStruct‘s "duckiness".

      o = OpenStruct.new
      o.t = 4
      o['t']  #=> 4

[]=(key,val)

Set a value in the OpenStruct by key, like a Hash.

      o = OpenStruct.new
      o['t'] = 4
      o.t  #=> 4

__merge__( other )

Merge hash data creating a new OpenStruct object.

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

__table__()

Provides public access to the inner table.

__update__( other )

Insert/update hash data on the fly.

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

instance_delegate()

Provides access to an OpenStruct‘s inner table.

      o = OpenStruct.new
      o.a = 1
      o.b = 2
      o.instance_delegate.each { |k, v| puts "#{k} #{v}" }

produces

      a 1
      b 2

to_h()

[Validate]