diff options
author | Darcy Laycock <sutto@thefrontiergroup.com.au> | 2011-01-20 14:24:07 +0800 |
---|---|---|
committer | Darcy Laycock <sutto@thefrontiergroup.com.au> | 2011-01-20 14:24:07 +0800 |
commit | 3ce12027af7015a22d6ec7c3e1ac7e0a9743f5fd (patch) | |
tree | 4f81b81d21bfe77096c647a7ea8d5f5f8e1df3e4 /lib/hashie/dash.rb | |
parent | 4db1a2b72c7fa4a3e1e8764da5c044f04c02aad3 (diff) | |
download | hashie-3ce12027af7015a22d6ec7c3e1ac7e0a9743f5fd.tar.gz |
Add in better default handling
Diffstat (limited to 'lib/hashie/dash.rb')
-rw-r--r-- | lib/hashie/dash.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/hashie/dash.rb b/lib/hashie/dash.rb index 861c4ad..74612fb 100644 --- a/lib/hashie/dash.rb +++ b/lib/hashie/dash.rb @@ -28,8 +28,10 @@ module Hashie self.properties << property_name - if options[:default] or self.defaults[property_name] + if options.has_key?(:default) self.defaults[property_name] = options[:default] + elsif self.defaults.has_key?(property_name) + self.defaults.delete property_name end unless instance_methods.map { |m| m.to_s }.include?("#{property_name}=") |