Class: Dichotomy::Base::Managers::BuildManager
- Inherits:
-
Object
- Object
- Dichotomy::Base::Managers::BuildManager
- Defined in:
- lib/dichotomy/base/managers/build_manager.rb
Instance Attribute Summary collapse
-
#registered_listeners ⇒ Object
readonly
Returns the value of attribute registered_listeners.
-
#strategies ⇒ Object
readonly
Returns the value of attribute strategies.
Instance Method Summary collapse
- #add_observer(klass) ⇒ Object
- #build(type) ⇒ Object
-
#initialize ⇒ BuildManager
constructor
A new instance of BuildManager.
- #reset_strategies ⇒ Object
Constructor Details
#initialize ⇒ BuildManager
Returns a new instance of BuildManager.
11 12 13 14 15 |
# File 'lib/dichotomy/base/managers/build_manager.rb', line 11 def initialize @strategies = Builder::Strategies::StagedStrategyChain.new(Builder::BuildStage) @registered_listeners = Array.new @registered_types = Array.new end |
Instance Attribute Details
#registered_listeners ⇒ Object (readonly)
Returns the value of attribute registered_listeners.
9 10 11 |
# File 'lib/dichotomy/base/managers/build_manager.rb', line 9 def registered_listeners @registered_listeners end |
#strategies ⇒ Object (readonly)
Returns the value of attribute strategies.
9 10 11 |
# File 'lib/dichotomy/base/managers/build_manager.rb', line 9 def strategies @strategies end |
Instance Method Details
#add_observer(klass) ⇒ Object
17 18 19 |
# File 'lib/dichotomy/base/managers/build_manager.rb', line 17 def add_observer(klass) @registered_listeners.push(klass) end |
#build(type) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/dichotomy/base/managers/build_manager.rb', line 21 def build(type) context = Builder::BuildContext.new(@strategies.make_strategy_chain, type, self, @registered_types) @strategies.clear_strategies @registered_listeners.each do |klass| context.add_observer(klass) end type = context.strategies.execute_build_up(context) if (type) @registered_types.push(type) end type end |
#reset_strategies ⇒ Object
39 40 41 |
# File 'lib/dichotomy/base/managers/build_manager.rb', line 39 def reset_strategies @strategies.clear_strategies end |