Class: Kubes::Hooks::Runner
- Inherits:
-
Object
- Object
- Kubes::Hooks::Runner
- Defined in:
- lib/kubes/hooks/runner.rb
Instance Method Summary collapse
-
#initialize(hook) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Methods included from Logging
Methods included from Util::Sh
Constructor Details
#initialize(hook) ⇒ Runner
Returns a new instance of Runner.
6 7 8 9 |
# File 'lib/kubes/hooks/runner.rb', line 6 def initialize(hook) @hook = hook @execute = @hook["execute"] end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/kubes/hooks/runner.rb', line 11 def run case @execute when String sh(@execute, exit_on_fail: @hook["exit_on_fail"]) when -> (e) { e.respond_to?(:public_instance_methods) && e.public_instance_methods.include?(:call) } @execute.new.call else @execute.call end end |