Class: Card::ActManager::SubdirectorArray
- Inherits:
-
Array
- Object
- Array
- Card::ActManager::SubdirectorArray
- Defined in:
- lib/card/act_manager/subdirector_array.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add(card, opts = {}) ⇒ Object
- #add_director(dir) ⇒ Object
- #delete(card) ⇒ Object
- #delete_director ⇒ Object
-
#initialize(parent) ⇒ SubdirectorArray
constructor
A new instance of SubdirectorArray.
Constructor Details
#initialize(parent) ⇒ SubdirectorArray
Returns a new instance of SubdirectorArray.
12 13 14 15 |
# File 'lib/card/act_manager/subdirector_array.rb', line 12 def initialize parent @parent = parent super() end |
Class Method Details
.initialize_with_subcards(parent) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/card/act_manager/subdirector_array.rb', line 4 def self.initialize_with_subcards parent dir_array = new(parent) parent.card.subcards.each_card do |subcard| dir_array.add subcard end dir_array end |
Instance Method Details
#add(card, opts = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/card/act_manager/subdirector_array.rb', line 17 def add card, opts={} opts ||= {} card = card.card if card.is_a? StageDirector each { |dir| return dir if dir.card == card } dir = ActManager.fetch card, parent: @parent dir.replace_card card if dir.card != card dir.main = false dir.parent = @parent dir.transact_in_stage = opts[:transact_in_stage] self << dir dir end |
#add_director(dir) ⇒ Object
40 41 42 |
# File 'lib/card/act_manager/subdirector_array.rb', line 40 def add_director dir add dir.card end |
#delete(card) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/card/act_manager/subdirector_array.rb', line 32 def delete card if card.is_a? StageDirector delete_director card else delete_if { |dir| dir.card == card } end end |
#delete_director ⇒ Object
30 |
# File 'lib/card/act_manager/subdirector_array.rb', line 30 alias_method :delete_director, :delete |