shallow_attributes icon indicating copy to clipboard operation
shallow_attributes copied to clipboard

fix coercion of ShallowAttributes values

Open morr opened this issue 5 years ago • 4 comments

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='

morr avatar Apr 08 '19 13:04 morr

Coverage Status

Coverage decreased (-0.1%) to 99.758% when pulling 6008302c194fd92d379863080f2105e3510c905c on morr:fix-coercion into 37fe19415397c78fcc40c562ea6b0b0b7c47cb16 on davydovanton:master.

coveralls avatar Apr 08 '19 13:04 coveralls

Coverage Status

Coverage increased (+0.002%) to 99.881% when pulling 9f0b031fd6e21f9603ad4413355e6bf2d098f7ce on morr:fix-coercion into 37fe19415397c78fcc40c562ea6b0b0b7c47cb16 on davydovanton:master.

coveralls avatar Apr 08 '19 13:04 coveralls

@davydovanton done

morr avatar Apr 09 '19 14:04 morr

It seems that pull request #32 also addresses this issue.

lmmendes avatar Aug 18 '19 16:08 lmmendes