Class: Brewby::Steps::DSL::Step

Inherits:
Object
  • Object
show all
Defined in:
lib/brewby/steps/dsl/step.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, application) ⇒ Step

Returns a new instance of Step.



6
7
8
9
10
# File 'lib/brewby/steps/dsl/step.rb', line 6

def initialize name, application
  @application = application
  @options = {}
  @options[:name] = name
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/brewby/steps/dsl/step.rb', line 5

def options
  @options
end

#step_classObject (readonly)

Returns the value of attribute step_class.



5
6
7
# File 'lib/brewby/steps/dsl/step.rb', line 5

def step_class
  @step_class
end

Instance Method Details

#create!Object



40
41
42
43
44
# File 'lib/brewby/steps/dsl/step.rb', line 40

def create!
  @options[:input] = @application.inputs.find { |i| i.name.to_sym == @options[:input] }
  @options[:output] = @application.outputs.find { |o| o.name.to_sym == @options[:output] }
  @step_class.new @options
end

#hold_duration(d) ⇒ Object



28
29
30
# File 'lib/brewby/steps/dsl/step.rb', line 28

def hold_duration d
  @options[:duration] = d
end

#input(i) ⇒ Object



32
33
34
# File 'lib/brewby/steps/dsl/step.rb', line 32

def input i
  @options[:input] = i
end

#mode(m) ⇒ Object



20
21
22
# File 'lib/brewby/steps/dsl/step.rb', line 20

def mode m
  @options[:mode] = m
end

#output(o) ⇒ Object



36
37
38
# File 'lib/brewby/steps/dsl/step.rb', line 36

def output o
  @options[:output] = o
end

#target(t) ⇒ Object



24
25
26
# File 'lib/brewby/steps/dsl/step.rb', line 24

def target t
  @options[:target] = t
end

#type(symbol, options = {}) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/brewby/steps/dsl/step.rb', line 12

def type symbol, options = {}
  @step_class = case symbol
  when :temp_control
    Brewby::Steps::TempControl
  end
  @options.merge!(options)
end