Class: Musa::GenerativeGrammar::Implementation::BlockNode 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 with dynamic content generated by block.
Executes block at generation time to produce content. Block receives parent elements and attributes.
Instance Method Summary collapse
- #_options(parent: nil, &condition) ⇒ Object private
-
#initialize(attributes) {|parent, attributes| ... } ⇒ BlockNode
constructor
private
A new instance of BlockNode.
Constructor Details
#initialize(attributes) {|parent, attributes| ... } ⇒ BlockNode
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 BlockNode.
486 487 488 489 |
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 486 def initialize(attributes, &block) @attributes = attributes @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.
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 492 def (parent: nil, &condition) parent ||= [] element = @block.call(parent, @attributes) element = OptionElement.new(element, @attributes) unless element.is_a?(OptionElement) if block_given? if yield(parent + [element], @attributes) [[element]] else [] end else [[element]] end end |