Method: Gorillib::Model::Reconcilable#adopt
- Defined in:
- lib/wu/model/reconcilable.rb
#adopt(obj) ⇒ Object
- asks the other object what attributes it has to give, via
#reconcilable_attrs - if this instance has a
adopt_foomethod, calls it; all further action (such as setting the consensus value) is done over there - otherwise, calls adopt_attribute(attr, val) to set the consensus value
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/wu/model/reconcilable.rb', line 14 def adopt(obj) peace = true obj.reconcilable_attributes.each do |attr, val| if self.respond_to?("adopt_#{attr}") result = self.public_send("adopt_#{attr}", val, obj) else result = adopt_attribute(attr, val) end peace &&= result end peace end |