Class: Musa::GenerativeGrammar::Implementation::ConditionNode
- Defined in:
- lib/musa-dsl/generative/generative-grammar.rb
Instance Method Summary collapse
- #_options(parent: nil, &condition) ⇒ Object
-
#initialize(node, &block) ⇒ ConditionNode
constructor
A new instance of ConditionNode.
Methods inherited from Node
#[], #limit, #next, #options, #or, #repeat, #size, #to_serie
Constructor Details
#initialize(node, &block) ⇒ ConditionNode
Returns a new instance of ConditionNode.
192 193 194 195 |
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 192 def initialize(node, &block) @node = node @block = block end |
Instance Method Details
#_options(parent: nil, &condition) ⇒ Object
197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 197 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 |