Module: Card::Set::All::AssignAttributes::ClassMethods

Defined in:
card/tmpsets/set/mod002-core/all/assign_attributes.rb,
card/tmpsets/set/mod002-core/all/assign_attributes.rb

Instance Method Summary collapse

Instance Method Details

#assign_or_newish(name, attributes, fetch_opts = {}) ⇒ Object



43
44
45
46
47
48
49
50
# File 'card/tmpsets/set/mod002-core/all/assign_attributes.rb', line 43

def assign_or_newish name, attributes, fetch_opts={}
  if (known_card = Card.fetch(name, fetch_opts))
    known_card.refresh.newish attributes
    known_card
  else
    Card.new attributes.merge(name: name)
  end
end