Class: Hash

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

Overview

DynaHash

© 2010 Tony Heupel

An extension to Ruby’s Hash class that allows for dot-notation access to a Hash’s keys as if they were just properties on the object. It strips out non-word characters and replaces them with ‘_’

Based off of my .NET/C# HyperDynamo work at github.com/tonyheupel/hypercore

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



14
15
16
# File 'lib/dynahash.rb', line 14

def method_missing(m, *args, &block)
  self.fetch(find_member(m))
end