Class: EacCli::Runner::ContextResponders::Parent

Inherits:
Base
  • Object
show all
Defined in:
lib/eac_cli/runner/context_responders/parent.rb

Instance Method Summary collapse

Methods inherited from Base

#if_callable

Instance Method Details

#call(*args, &block) ⇒ Object



18
19
20
21
22
23
# File 'lib/eac_cli/runner/context_responders/parent.rb', line 18

def call(*args, &block)
  return parent.runner_context.call(method_name, *args, &block) if
    parent.respond_to?(:runner_context)

  raise "Parent #{parent} do not respond to .context or .runner_context (Runner: #{runner})"
end

#callable?Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
16
# File 'lib/eac_cli/runner/context_responders/parent.rb', line 10

def callable?
  parent.if_present(false) do |v|
    next true if v.respond_to?(method_name)

    v.if_respond(:runner_context, false) { |w| w.parent_respond_to?(method_name) }
  end
end