shallow_attributes
shallow_attributes copied to clipboard
fix coercion of ShallowAttributes values
This PR fixes such cases:
class A
include ShallowAttributes
attribute :a, Integer
end
class B
include ShallowAttributes
attribute :b, Array, of: A
end
a = A.new(a: 1)
b = B.new(b: [a])
NoMethodError: undefined method `each_pair' for #<A a=1>
from /Users/morr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/shallow_attributes-0.9.4/lib/shallow_attributes/instance_methods.rb:90:in `attributes='
Coverage decreased (-0.1%) to 99.758% when pulling 6008302c194fd92d379863080f2105e3510c905c on morr:fix-coercion into 37fe19415397c78fcc40c562ea6b0b0b7c47cb16 on davydovanton:master.
Coverage increased (+0.002%) to 99.881% when pulling 9f0b031fd6e21f9603ad4413355e6bf2d098f7ce on morr:fix-coercion into 37fe19415397c78fcc40c562ea6b0b0b7c47cb16 on davydovanton:master.
@davydovanton done
It seems that pull request #32 also addresses this issue.