Class: Card::DirectorRegister
Class Method Summary collapse
- .act_director ⇒ Object
- .add(director) ⇒ Object
- .clear ⇒ Object
- .delete(director) ⇒ Object
- .directors ⇒ Object
- .fetch(card, opts = {}) ⇒ Object
- .to_s ⇒ Object
Class Method Details
.act_director ⇒ Object
35 36 37 38 |
# File 'lib/card/director_register.rb', line 35 def act_director return unless DirectorRegister.act_card DirectorRegister.act_card.director end |
.add(director) ⇒ Object
56 57 58 |
# File 'lib/card/director_register.rb', line 56 def add director directors[director.card] = director end |
.clear ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/card/director_register.rb', line 44 def clear DirectorRegister.act_card = nil directors.each_pair do |card, _dir| card.director = nil end @directors = nil end |
.delete(director) ⇒ Object
60 61 62 63 64 |
# File 'lib/card/director_register.rb', line 60 def delete director return unless @directors @directors.delete director.card director.delete end |
.directors ⇒ Object
40 41 42 |
# File 'lib/card/director_register.rb', line 40 def directors @directors ||= {} end |
.fetch(card, opts = {}) ⇒ Object
52 53 54 |
# File 'lib/card/director_register.rb', line 52 def fetch card, opts={} directors[card] ||= Card.new_director card, opts end |
.to_s ⇒ Object
66 67 68 |
# File 'lib/card/director_register.rb', line 66 def to_s directors.values.map(&:to_s).join "\n" end |