diff options
Diffstat (limited to 'lib/hashie/dash.rb')
-rw-r--r-- | lib/hashie/dash.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/hashie/dash.rb b/lib/hashie/dash.rb index cc20a93..4ac7676 100644 --- a/lib/hashie/dash.rb +++ b/lib/hashie/dash.rb @@ -97,7 +97,11 @@ module Hashie self.class.defaults.each_pair do |prop, value| self[prop] = begin val = value.dup - val.is_a?(Proc) && val.arity > 0 ? val.call(self) : val + if val.is_a?(Proc) + val.arity == 1 ? val.call(self) : val.call + else + val + end rescue TypeError value end |