Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/standard/hash.rb

Overview

Copyright 2014 Maxine Red <[email protected]>

This file is part of rubyhexagon.

rubyhexagon is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

rubyhexagon is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with rubyhexagon.  If not, see <http://www.gnu.org/licenses/>.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, args = nil) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/standard/hash.rb', line 21

def method_missing(m,args=nil)
  m = m.to_s
  if self.has_key?(m) then
    return a[m]
  else
    raise NoMethodError, "undefined method #{m} for #{self.class}"
  end
end