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

Defined in:
platypus/tmp/set/gem-card/mod001-core/all/assign_attributes.rb

Instance Method Summary collapse

Instance Method Details

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



29
30
31
32
33
34
35
36
# File 'platypus/tmp/set/gem-card/mod001-core/all/assign_attributes.rb', line 29

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