Class: EacCli::Runner::ContextResponders::Set

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#if_callable

Constructor Details

#initialize(context, method_name, responders_names) ⇒ Set

Returns a new instance of Set.



12
13
14
15
# File 'lib/eac_cli/runner/context_responders/set.rb', line 12

def initialize(context, method_name, responders_names)
  super(context, method_name)
  @responders_names = responders_names
end

Instance Attribute Details

#responders_namesObject (readonly)

Returns the value of attribute responders_names.



10
11
12
# File 'lib/eac_cli/runner/context_responders/set.rb', line 10

def responders_names
  @responders_names
end

Instance Method Details

#callObject

Raises:

  • (::NameError)


21
22
23
24
25
26
# File 'lib/eac_cli/runner/context_responders/set.rb', line 21

def call(...)
  caller = responder_to_call
  return caller.call(...) if caller

  raise ::NameError, "No method \"#{method_name}\" found in #{runner} or in its ancestors"
end

#callable?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/eac_cli/runner/context_responders/set.rb', line 17

def callable?
  responders_instances.any?(&:callable?)
end