Module: Card::Set::Abstract::CodePointer::ClassMethods

Defined in:
card/tmpsets/set/mod009-card-mod-list/abstract/code_pointer.rb,
card/tmpsets/set/mod008-card-mod-list/abstract/code_pointer.rb

Overview

simplify api Self::MyCodePointerSet.add_item :my_item_codename instead of Self::MyCodePointerSet.add_to_basket :item_codenames, :my_item_codename

Instance Method Summary collapse

Instance Method Details

#add_item(codename) ⇒ Object



17
18
19
20
21
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/code_pointer.rb', line 17

def add_item codename
  valid_codename codename do
    add_to_basket :item_codenames, codename
  end
end

#unshift_item(codename) ⇒ Object



23
24
25
26
27
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/code_pointer.rb', line 23

def unshift_item codename
  valid_codename codename do
    unshift_basket :item_codenames, codename
  end
end

#valid_codename(codename) ⇒ Object



29
30
31
32
33
34
35
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/code_pointer.rb', line 29

def valid_codename codename
  if Card::Codename.exist? codename
    yield
  else
    Rails.logger.info "unknown codename '#{codename}' added to code pointer"
  end
end