Class: Musa::GenerativeGrammar::Implementation::ConditionNode Private
- Defined in:
- lib/musa-dsl/generative/generative-grammar.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Node that filters child node options by condition.
Applies condition block to filter generated options. Created by Node#limit.
Instance Method Summary collapse
- #_options(parent: nil, &condition) ⇒ Object private
-
#initialize(node) {|option| ... } ⇒ ConditionNode
constructor
private
A new instance of ConditionNode.
Constructor Details
#initialize(node) {|option| ... } ⇒ ConditionNode
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ConditionNode.
520 521 522 523 |
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 520 def initialize(node, &block) @node = node @block = block end |
Instance Method Details
#_options(parent: nil, &condition) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
526 527 528 529 530 531 532 533 534 535 536 |
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 526 def (parent: nil, &condition) parent ||= [] r = [] @node.(parent: parent, &condition).each do |node_option| r << node_option if (!block_given? || yield(parent + node_option)) && @block.call(parent + node_option) end r end |