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| ... } ⇒ void constructor private
Constructor Details
#initialize(attributes) {|parent, attributes| ... } ⇒ void
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.
504 505 506 507 |
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 504 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.
510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 510 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 |