diff options
author | Doc Ritezel <pair+doc@pivotallabs.com> | 2013-02-12 14:18:52 -0800 |
---|---|---|
committer | Doc Ritezel <pair+doc@pivotallabs.com> | 2013-02-12 14:22:56 -0800 |
commit | f2090d35e764c640d9436eeefd015717f2df05c9 (patch) | |
tree | 3b3c1ec93b40eac97873748faa56f1a5bc897cc7 | |
parent | 1d5e2155fb496c5581999d97b937c6904392165b (diff) | |
download | hashie-f2090d35e764c640d9436eeefd015717f2df05c9.tar.gz |
Concisely handle TypeError in Hashie::Dash
-rw-r--r-- | lib/hashie/dash.rb | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/hashie/dash.rb b/lib/hashie/dash.rb index 99386c4..bdc256d 100644 --- a/lib/hashie/dash.rb +++ b/lib/hashie/dash.rb @@ -90,14 +90,10 @@ module Hashie super(&block) self.class.defaults.each_pair do |prop, value| - self[prop] = if value.is_a?(Numeric) + self[prop] = begin + value.dup + rescue TypeError value - else - begin - value.dup - rescue TypeError - value - end end end |