lib/motion-map/map.rb
# a sane method missing that only supports writing values or reading
# *previously set* values
#
a sane method missing that only supports writing values or reading
previously set* values
a sane method missing that only supports writing values or reading previously set * values
def method_missing(*args, &block)
      method = args.first.to_s
      case method
        when /=$/
          key = args.shift.to_s.chomp('=')
          value = args.shift
          self[key] = value
        when /\?$/
          key = args.shift.to_s.chomp('?')
          self.has?( key )
        else
          key = method
          unless has_key?(key)
            return(block ? fetch(key, &block) : super(*args))
          end
          self[key]
      end
    end
def method_missing ( * args , & block ) method = args . first . to_s case method when / =$ / key = args . shift . to_s . chomp ( '=' ) value = args . shift self [ key ] = value when / \? $ / key = args . shift . to_s . chomp ( '?' ) self . has? ( key ) else key = method unless has_key? ( key ) return ( block ? fetch ( key , & block ) : super ( * args ) ) end self [ key ] end end
a sane method missing that only supports writing values or reading
previously set* values
a sane method missing that only supports writing values or reading previously set * values
args
<not_specific>
block
<not_specific>