summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoc Ritezel <pair+doc@pivotallabs.com>2013-02-12 14:18:52 -0800
committerDoc Ritezel <pair+doc@pivotallabs.com>2013-02-12 14:22:56 -0800
commitf2090d35e764c640d9436eeefd015717f2df05c9 (patch)
tree3b3c1ec93b40eac97873748faa56f1a5bc897cc7
parent1d5e2155fb496c5581999d97b937c6904392165b (diff)
downloadhashie-f2090d35e764c640d9436eeefd015717f2df05c9.tar.gz
Concisely handle TypeError in Hashie::Dash
-rw-r--r--lib/hashie/dash.rb10
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