Module: Card::Set::All::AssignAttributes::ClassMethods
- Defined in:
- tmpsets/set/mod003-core/all/assign_attributes.rb
Instance Method Summary collapse
Instance Method Details
#assign_or_initialize_by(name, attributes, fetch_opts = {}) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'tmpsets/set/mod003-core/all/assign_attributes.rb', line 43 def assign_or_initialize_by name, attributes, fetch_opts={} if (known_card = Card.fetch(name, fetch_opts)) known_card.refresh.assign_attributes attributes known_card else Card.new attributes.merge(name: name) end end |