Class: Tabry::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/tabry/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config:) ⇒ Runner

Returns a new instance of Runner.



14
15
16
17
18
19
20
21
# File 'lib/tabry/runner.rb', line 14

def initialize(config:)
  @config = if config.is_a?(Tabry::Models::Config)
              config
            else
              ConfigLoader.load(name: config)

            end
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



12
13
14
# File 'lib/tabry/runner.rb', line 12

def config
  @config
end

Instance Method Details

#options(args, last = nil, params = {}) ⇒ Object



23
24
25
# File 'lib/tabry/runner.rb', line 23

def options(args, last = nil, params = {})
  options_finder(args, params).options(last)
end

#options_finder(args, params = {}) ⇒ Object



27
28
29
# File 'lib/tabry/runner.rb', line 27

def options_finder(args, params = {})
  Tabry::OptionsFinder.new(parse(args), params)
end

#parse(args) ⇒ Object



31
32
33
34
# File 'lib/tabry/runner.rb', line 31

def parse(args)
  state = Tabry::Machine.run(config, args)
  Tabry::Result.new(config, state)
end