Class: CallableTree::Node::Internal::Strategy::Seek
- Inherits:
-
Object
- Object
- CallableTree::Node::Internal::Strategy::Seek
- Includes:
- CallableTree::Node::Internal::Strategy
- Defined in:
- lib/callable_tree/node/internal/strategy/seek.rb
Instance Method Summary collapse
Methods included from CallableTree::Node::Internal::Strategy
Instance Method Details
#call(nodes, *inputs, **options) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/callable_tree/node/internal/strategy/seek.rb', line 10 def call(nodes, *inputs, **) nodes .lazy .select { |node| node.match?(*inputs, **) } .map do |node| output = node.call(*inputs, **) terminated = node.terminate?(output, *inputs, **) [output, terminated] end .select { |_output, terminated| terminated } .map { |output, _terminated| output } .first end |