Class: Batsir::Chain

Inherits:
Object
  • Object
show all
Defined in:
lib/batsir/chain.rb

Instance Method Summary collapse

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(options = {})
  options.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

#compileObject



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

#stagesObject



11
12
13
# File 'lib/batsir/chain.rb', line 11

def stages
  @stages
end

#startObject



27
28
29
30
31
# File 'lib/batsir/chain.rb', line 27

def start
  stages.each do | stage |
    stage.start
  end
end