class Kubes::Hooks::Runner

Public Class Methods

new(hook) click to toggle source
# File lib/kubes/hooks/runner.rb, line 6
def initialize(hook)
  @hook = hook
  @execute = @hook["execute"]
end

Public Instance Methods

run() click to toggle source
# 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