You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
options[:fragment] seems to correspond to the wrong property when referenced inside a setter block for a collection property.
Manufactured example:
class DemoRepresenter < Representable::Decorator
include Representable::Hash
property :foo
collection :bars, setter: ->(options) do
p "Input in setter for bars is value #{options[:input]}"
p "Fragment in setter for bars is value #{options[:fragment]}"
end
end
DemoRepresenter.new(OpenStruct.new).from_hash(
{"foo"=>"fooValue", "bars"=>["barValue1", "barValue2"]}
).to_h
Actual:
The above code prints the following:
"Input in setter for bars is value [\"barValue1\", \"barValue2\"]"
"Fragment in setter for bars is value fooValue"
Expected:
The expected behavior would be for the fragment to correspond to ["barValue1", "barValue2"] since it's in the scope of the bars property.
Version:
3.0.4
The text was updated successfully, but these errors were encountered:
Problem
options[:fragment]
seems to correspond to the wrong property when referenced inside asetter
block for acollection
property.Manufactured example:
Actual:
The above code prints the following:
Expected:
The expected behavior would be for the fragment to correspond to
["barValue1", "barValue2"]
since it's in the scope of thebars
property.Version:
3.0.4
The text was updated successfully, but these errors were encountered: