Class: Rustic::Evaluator
- Inherits:
-
Object
- Object
- Rustic::Evaluator
- Includes:
- Console
- Defined in:
- lib/rustic/evaluator.rb
Instance Method Summary collapse
- #evaluate ⇒ Object
-
#initialize(command, config) ⇒ Evaluator
constructor
A new instance of Evaluator.
- #on_error(error) ⇒ Object
- #with_hooks(config, args = nil, &block) ⇒ Object
Constructor Details
#initialize(command, config) ⇒ Evaluator
Returns a new instance of Evaluator.
6 7 8 9 |
# File 'lib/rustic/evaluator.rb', line 6 def initialize(command, config) @command = command @config = config end |
Instance Method Details
#evaluate ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rustic/evaluator.rb', line 11 def evaluate with_hooks(@config) do builder = Rustic::CommandBuilder.new(@command, @config) command, env, config = builder.build with_hooks(config) do Rustic::Wrapper.new(command, env).run end end rescue StandardError => e on_error(e) raise end |
#on_error(error) ⇒ Object
25 |
# File 'lib/rustic/evaluator.rb', line 25 def on_error(error) = @config.on_error&.call(error) |
#with_hooks(config, args = nil, &block) ⇒ Object
26 |
# File 'lib/rustic/evaluator.rb', line 26 def with_hooks(config, args = nil, &block) = Rustic::Hooks.new(config).with_hooks(args, &block) |