class Hash

Public Instance Methods

/(key) click to toggle source
# File lib/asciitracker/hash_ext.rb, line 1
def /(key);self[key];end
method_missing(m,*a) click to toggle source

_why’s hash implant with a twist: the difference is to throw a NoMethodError instead returning nil when asking for a non-existing value

# File lib/asciitracker/hash_ext.rb, line 6
def method_missing(m,*a)
  if m.to_s =~ /=$/
    self[$`.to_sym] = a[0]
  elsif a.empty?
    self[m]
  else
    raise NoMethodError, "#{m}"
  end
end