public
Description: A Hash that allows method calls to get elements
Homepage:
Clone URL: git://github.com/madx/metash.git
metash /
name age message
file .gitignore Sat Jan 17 15:46:12 -0800 2009 refactoring the whole thing Don't subclass has... [madx]
file README.textile Sun Jan 18 12:15:37 -0800 2009 adding examples to the README [madx]
file Rakefile Mon Jun 15 05:15:35 -0700 2009 add gem [madx]
directory lib/ Tue Jun 16 06:48:57 -0700 2009 make instance_eval callable to allow nice DSLs [madx]
file metash.gemspec Tue Jun 16 06:48:57 -0700 2009 make instance_eval callable to allow nice DSLs [madx]
file metash_spec.rb Tue Jun 16 06:48:57 -0700 2009 make instance_eval callable to allow nice DSLs [madx]
README.textile

Metash

Metash is a Ruby library that allow what I call “Meta Hashes”.

A Metash is a kind of hash that allows method chaining to get the values
using a bit of method_missing magic. This gives a nice interface for Hashes.

Example

  c = Metash.new :key1 => "value1", :nested => {:key2 => "value2"}
  c.key1                        # => "value1"
  c.nested.key2                 # => "value2"
  c.nested.key2 "Another value"
  c.nested.key2                 # => "Another value"
  c.key3 "value3"               # c.key3 # => "value3"
  c.key4                        # => nil