Parent

OpenHash

OpenHash

OpenHash is akin to an OpenStruct or an OpenObject, but it is much simplier in nature. It is a hash with an method_missing definition that routes to [] and []=.

Public Class Methods

new(data) click to toggle source

New OpenHash.

    # File lib/more/facets/openhash.rb, line 22
22:   def initialize(data)
23:     super()
24:     update(data)
25:   end

Public Instance Methods

method_missing(s, *a) click to toggle source

Route get and set calls.

    # File lib/more/facets/openhash.rb, line 29
29:   def method_missing(s, *a)
30:     if s =~ /=$/
31:       self[s] = a[0]
32:     elsif a.empty?
33:       self[s]
34:     else
35:       super
36:     end
37:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.