|
|
@ -114,7 +114,7 @@ class Compound < MemStruct
|
|
|
|
def _set(h)
|
|
|
|
def _set(h)
|
|
|
|
case h
|
|
|
|
case h
|
|
|
|
when Hash; h.each { |k, v| send("_#{k}=", v) }
|
|
|
|
when Hash; h.each { |k, v| send("_#{k}=", v) }
|
|
|
|
when Array; names = _field_names ; raise 'bad size' if names.length != h.length ; names.zip(h).each { |n, a| send("#{n}=", a }
|
|
|
|
when Array; names = _field_names ; raise 'bad size' if names.length != h.length ; names.zip(h).each { |n, a| send("#{n}=", a) }
|
|
|
|
when Compound; _field_names.each { |n| send("#{n}=", h.send(n)) }
|
|
|
|
when Compound; _field_names.each { |n| send("#{n}=", h.send(n)) }
|
|
|
|
else raise 'wut?'
|
|
|
|
else raise 'wut?'
|
|
|
|
end
|
|
|
|
end
|
|
|
|