summaryrefslogtreecommitdiff
path: root/lib/hashie
diff options
context:
space:
mode:
authorMax Lincoln <max@devopsy.com>2014-08-08 13:38:15 -0400
committerMax Lincoln <max@devopsy.com>2014-08-08 13:38:15 -0400
commitdcde6199006fb77dc9e87408bfed9b9215b4c559 (patch)
tree36ff0d186a4d68faad342955e866fa709202e106 /lib/hashie
parent2b824ca72c12c9eb699e21f6a52f07f44af5723d (diff)
downloadhashie-dcde6199006fb77dc9e87408bfed9b9215b4c559.tar.gz
Remove built-in support for boolean, but all a proc
Diffstat (limited to 'lib/hashie')
-rw-r--r--lib/hashie/extensions/coercion.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/hashie/extensions/coercion.rb b/lib/hashie/extensions/coercion.rb
index 681a0af..c0fb8fb 100644
--- a/lib/hashie/extensions/coercion.rb
+++ b/lib/hashie/extensions/coercion.rb
@@ -38,12 +38,9 @@ module Hashie
end
def coerce_or_init(type)
- if type == :boolean
- ->(v) do
- return v if v == !!v
- fail NotImplementedError, 'Boolean coercion is not supported'
- end
- elsif CORE_TYPES.key?(type)
+ return type if type.is_a? Proc
+
+ if CORE_TYPES.key?(type)
->(v) do
return v if v.is_a? type
return v.send(CORE_TYPES[type])