diff options
author | Michael Bleigh <michael@intridea.com> | 2009-11-12 09:33:24 -0500 |
---|---|---|
committer | Michael Bleigh <michael@intridea.com> | 2009-11-12 09:33:24 -0500 |
commit | 6b5d126f986b56b92c960c77d7bd1020a63dd447 (patch) | |
tree | 94a37528adda5e19338be3ab122de3ff5af8ced6 | |
parent | 14ea3cff642b5e8cd1c970e84db02eb336d4db45 (diff) | |
download | hashie-6b5d126f986b56b92c960c77d7bd1020a63dd447.tar.gz |
Symbolize inbound keys on Dash, update README, ignore .gemspec since GitHub doesn't build gems anymore.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | README.rdoc | 9 | ||||
-rw-r--r-- | lib/hashie/dash.rb | 2 |
3 files changed, 7 insertions, 5 deletions
@@ -3,3 +3,4 @@ coverage rdoc pkg +/hashie.gemspec
\ No newline at end of file diff --git a/README.rdoc b/README.rdoc index fcba853..3b07d55 100644 --- a/README.rdoc +++ b/README.rdoc @@ -50,13 +50,14 @@ can set defaults for each property. property :email property :occupation, :default => 'Rubyist' end - + p = Person.new p.name # => nil - p.occupation # => 'Rubyist' p.email = 'abc@def.com' - p.email # => 'abc@def.com' - p['awesome'] # => NoMethodError + p.occupation # => 'Rubyist' + p.email # => 'abc@def.com' + p[:awesome] # => NoMethodError + p[:occupation] # => 'Rubyist' == Note on Patches/Pull Requests diff --git a/lib/hashie/dash.rb b/lib/hashie/dash.rb index 9e5bb48..944763c 100644 --- a/lib/hashie/dash.rb +++ b/lib/hashie/dash.rb @@ -56,7 +56,7 @@ module Hashie # Retrieve a value from the Dash (will return the # property's default value if it hasn't been set). def [](property_name) - super || self.class.defaults[property_name.to_sym] + super(property_name.to_sym) || self.class.defaults[property_name.to_sym] end # Set a value on the Dash in a Hash-like way. Only works |