diff options
Diffstat (limited to 'README.rdoc')
-rw-r--r-- | README.rdoc | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/README.rdoc b/README.rdoc index 2fdf033..a8b8d10 100644 --- a/README.rdoc +++ b/README.rdoc @@ -4,14 +4,8 @@ Hashie is a growing collection of tools that extend Hashes and make them more useful. == Installation - -Hashie is a gem and is available on Gemcutter. If you don't have Gemcutter, -install it: - - gem install gemcutter - gem tumble -Then you can install Hashie: +Hashie is available as a RubyGem: gem install hashie @@ -62,7 +56,33 @@ can set defaults for each property. p = Person.new(:name => "Bob") p.name # => 'Bob' p.occupation # => 'Rubyist' - + +== Clash + +Clash is a Chainable Lazy Hash that allows you to easily construct +complex hashes using method notation chaining. This will allow you +to use a more action-oriented approach to building options hashes. + +Essentially, a Clash is a generalized way to provide much of the same +kind of "chainability" that libraries like Arel or Rails 2.x's named_scopes +provide. + +=== Example + + c = Hashie::Clash.new + c.where(:abc => 'def').order(:created_at) + c # => {:where => {:abc => 'def}, :order => :created_at} + + # You can also use bang notation to chain into sub-hashes, + # jumping back up the chain with _end! + c = Hashie::Clash.new + c.where!.abc('def').ghi(123)._end!.order(:created_at) + c # => {:where => {:abc => 'def', :ghi => 123}, :order => :created_at} + + # Multiple hashes are merged automatically + c = Hashie::Clash.new + c.where(:abc => 'def').where(:hgi => 123) + c # => {:where => {:abc => 'def', :hgi => 123}} == Note on Patches/Pull Requests |