Module: Nake::HashStructMixin

Defined in:
lib/nake/struct_hash.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/nake/struct_hash.rb', line 8

def method_missing(name, *args, &block)
  if args.empty? && block.nil?
    # options.name
    if value = self[name]
      return value
    # options.force?
    elsif name.to_s.match(/^(.*)\?$/) && value = self[$1.to_sym]
      return value
    end
  end

  super(name, *args, &block)
end