Closed
Description
When a layout makes a relative adjustment to a key that does not appear in the last layout specified in extends
, the value for that key is left as the string value including the operator (e.g. '+= 100'
).
For example, the example in the documentation for multiple inheritence will fail because x
is a string:
socrates:
x: 100
plato:
y: 200
aristotle:
extends:
- socrates
- plato
x: += 50 # evaluates to 250 from plato
require 'squib'
Squib::Deck.new(cards: 1, layout: 'test.yml') do
circle radius: 50, layout: :aristotle
save_png prefix: 'test_'
end
lib/ruby/2.4.0/forwardable.rb:229:in `arc': no implicit conversion to float from string (TypeError)
I'm new to Ruby, so I may be reading something wrong, but it looks like recurse_extends merges the current layout with each parent separately (so aristotle/socrates['x']
is 150
, aristotle/plato['x']
is '+= 50'
), then those are all merged with the later parents taking priority when multiple values exist for the same key. Since aristotle/plato['x']
technically has a value, it overwrites the expected value, so aristotle['x'] == '+= 50'
.
Metadata
Metadata
Assignees
Labels
No labels