Browse files

Don't use Module#=== explicitly, Array === value returns false althou…

…gh value.class returns Array
  • Loading branch information...
1 parent 20c7dba commit 6042f4c7859f5dbaf2cc583e03abf7c035aa1b55 @tomlion tomlion committed May 28, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/ripple/associations.rb
View
6 lib/ripple/associations.rb
@@ -323,11 +323,11 @@ def verify_type!(value, owner)
def type_matches?(value)
case
when polymorphic?
- one? || Array === value
+ one? || value.is_a?(Array)
when many?
- Array === value && value.all? {|d| (embedded? && Hash === d) || d.kind_of?(klass) }
+ value.is_a?(Array) && value.all? {|d| (embedded? && d.is_a?(Hash)) || d.kind_of?(klass) }
when one?
- value.nil? || (embedded? && Hash === value) || value.kind_of?(klass)
+ value.nil? || (embedded? && value.is_a?(Hash)) || value.kind_of?(klass)
end
end

0 comments on commit 6042f4c

Please sign in to comment.