Class: Card::DirectorRegister

Inherits:
Object
  • Object
show all
Defined in:
lib/card/director_register.rb

Class Method Summary collapse

Class Method Details

.act_directorObject



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

.clearObject



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

.directorsObject



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_sObject



66
67
68
# File 'lib/card/director_register.rb', line 66

def to_s
  directors.values.map(&:to_s).join "\n"
end