Sha256: 17074c4cde0a0934f5978140449464adb423874fa5eedad7a5d63b20ee207221

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

module Brewby
  module Steps
    module DSL
      class Step
        attr_reader :step_class, :options
        def initialize name, application
          @application = application
          @options = {}
          @options[:name] = name
        end

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

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

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

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

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

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

        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
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
brewby-0.1.1 lib/brewby/steps/dsl/step.rb
brewby-0.1.0 lib/brewby/steps/dsl/step.rb