G
Giles Bowkett
Object X is going to be an exact clone of Object Y, but it's a member
of a different class.
This does not work:
x.attributes.each {|attr, value| eval("y.#{attr}= #{value}")}
irb says:
(eval):1: warning: parenthesize argument(s) for future version
SyntaxError: (eval):1:in `irb_binding': compile error
(eval):1: parse error, unexpected tINTEGER, expecting $
wv.updated_at= Mon May 07 11:13:27 -0700 2007
The second two lines make perfect sense to me; the first two seem pretty weird.
I suppose I should just create an AbstractZ class, from which both Y
and X inherit.
of a different class.
This does not work:
x.attributes.each {|attr, value| eval("y.#{attr}= #{value}")}
irb says:
(eval):1: warning: parenthesize argument(s) for future version
SyntaxError: (eval):1:in `irb_binding': compile error
(eval):1: parse error, unexpected tINTEGER, expecting $
wv.updated_at= Mon May 07 11:13:27 -0700 2007
The second two lines make perfect sense to me; the first two seem pretty weird.
I suppose I should just create an AbstractZ class, from which both Y
and X inherit.