# File lib/map/struct.rb, line 8 def initialize(map) @map = map end
# File lib/map/struct.rb, line 12 def method_missing(method, *args, &block) method = method.to_s case method when %r=$/ key = method.chomp('=') value = args.shift @map[key] = value when %r\?$/ key = method.chomp('?') value = @map.has?( key ) else key = method raise(IndexError, key) unless @map.has_key?(key) value = @map[key] end value.is_a?(Map) ? value.struct : value end