Class: Batsir::Chain
- Inherits:
-
Object
- Object
- Batsir::Chain
- Defined in:
- lib/batsir/chain.rb
Instance Method Summary collapse
- #add_stage(stage) ⇒ Object
- #compile ⇒ Object
-
#initialize(options = {}) ⇒ Chain
constructor
A new instance of Chain.
- #stages ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Chain
Returns a new instance of Chain.
4 5 6 7 8 9 |
# File 'lib/batsir/chain.rb', line 4 def initialize( = {}) .each do |attr, value| self.send("#{attr.to_s}=", value) end @stages = [] end |
Instance Method Details
#add_stage(stage) ⇒ Object
15 16 17 |
# File 'lib/batsir/chain.rb', line 15 def add_stage(stage) @stages << stage end |
#compile ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/batsir/chain.rb', line 19 def compile generated = "" stages.each do |stage| generated << stage.compile end generated end |
#stages ⇒ Object
11 12 13 |
# File 'lib/batsir/chain.rb', line 11 def stages @stages end |
#start ⇒ Object
27 28 29 30 31 |
# File 'lib/batsir/chain.rb', line 27 def start stages.each do | stage | stage.start end end |