Class: Tabry::Runner
- Inherits:
-
Object
- Object
- Tabry::Runner
- Defined in:
- lib/tabry/runner.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(config:) ⇒ Runner
constructor
A new instance of Runner.
- #options(args, last = nil, params = {}) ⇒ Object
- #options_finder(args, params = {}) ⇒ Object
- #parse(args) ⇒ Object
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
#config ⇒ Object (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 (args, last = nil, params = {}) (args, params).(last) end |
#options_finder(args, params = {}) ⇒ Object
27 28 29 |
# File 'lib/tabry/runner.rb', line 27 def (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 |