Class: Proc::Composition
- Inherits:
-
Composer::Composition
- Object
- Composer::Composition
- Proc::Composition
- Defined in:
- lib/proc/composition.rb
Instance Method Summary collapse
-
#call(input = input_omitted = true, **arguments) ⇒ Object
- public
-
Dispatches this composition to proc using the client.
-
#each(input = input_omitted = true, **arguments, &block) ⇒ Object
- public
-
Dispatches this composition to proc using the client, calling the given block once for each value.
-
#initialize(client:, **kwargs) ⇒ Composition
constructor
A new instance of Composition.
Constructor Details
#initialize(client:, **kwargs) ⇒ Composition
Returns a new instance of Composition.
7 8 9 10 11 |
# File 'lib/proc/composition.rb', line 7 def initialize(client:, **kwargs) @client = client super(**kwargs) end |
Instance Method Details
#call(input = input_omitted = true, **arguments) ⇒ Object
- public
-
Dispatches this composition to proc using the client.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/proc/composition.rb', line 15 def call(input = input_omitted = true, **arguments) if block_given? arguments[:proc] = yield end callable = build_composition( input: input_omitted ? @input : input, arguments: @arguments.merge(arguments), callables: @callables.dup ) @client.call("core.exec", Proc::Composer.undefined, proc: callable) end |
#each(input = input_omitted = true, **arguments, &block) ⇒ Object
- public
-
Dispatches this composition to proc using the client, calling the given block once for each value.
31 32 33 34 35 36 37 38 39 |
# File 'lib/proc/composition.rb', line 31 def each(input = input_omitted = true, **arguments, &block) callable = build_composition( client: @client, input: input_omitted ? @input : input, arguments: @arguments.merge(arguments) ) @client.call("core.exec", Proc::Composer.undefined, proc: callable, &block) end |