summaryrefslogtreecommitdiff
path: root/lib/hashie/extensions/coercion.rb
diff options
context:
space:
mode:
authorAlexander Graul <agraul@suse.com>2018-09-22 21:04:41 +0200
committerAlexander Graul <agraul@suse.com>2018-09-22 21:04:41 +0200
commit2fe53852a40de4015749c9545f929a66fa925580 (patch)
tree737289f2d13accafcd4dc230d1402d28f09b7def /lib/hashie/extensions/coercion.rb
parent7ed267b64c03aaef32bbb756a21a18fd2d4504f0 (diff)
downloadhashie-2fe53852a40de4015749c9545f929a66fa925580.tar.gz
Use == instead of <= in build_coercion
To check if the type class is a Hash, it is more readable to use `==` than `<=`. It returns `false`/`true` instead of `nil`/`0`, but this doesn't make a different when using it in a condition. Co-authored-by: Ana María Martínez Gómez <ammartinez@suse.de>
Diffstat (limited to 'lib/hashie/extensions/coercion.rb')
-rw-r--r--lib/hashie/extensions/coercion.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/hashie/extensions/coercion.rb b/lib/hashie/extensions/coercion.rb
index 704343e..2818c7f 100644
--- a/lib/hashie/extensions/coercion.rb
+++ b/lib/hashie/extensions/coercion.rb
@@ -159,7 +159,7 @@ module Hashie
def build_coercion(type)
if type.is_a? Enumerable
- if type.class <= ::Hash
+ if type.class == ::Hash
type, key_type, value_type = type.class, *type.first
build_hash_coercion(type, key_type, value_type)
else # Enumerable but not Hash: Array, Set