Class: AttHash

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/yearbook/att_hash.rb

Instance Method Summary collapse

Constructor Details

#initializeAttHash

Returns a new instance of AttHash.



5
6
7
8
# File 'lib/yearbook/att_hash.rb', line 5

def initialize
  @hsh = {}
  super(@hsh)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(foo, *args, &blk) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/yearbook/att_hash.rb', line 10

def method_missing(foo, *args, &blk)
  if @hsh.respond_to?(foo)
    @hsh.send(foo, *args, &blk)
  else
   @hsh[foo.to_sym] = args
  end
end