Class: Musa::GenerativeGrammar::Implementation::FinalNode

Inherits:
Node
  • Object
show all
Defined in:
lib/musa-dsl/generative/generative-grammar.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#[], #limit, #next, #options, #or, #repeat, #size, #to_serie

Constructor Details

#initialize(content, attributes) ⇒ FinalNode

Returns a new instance of FinalNode.



147
148
149
150
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 147

def initialize(content, attributes)
  super()
  @element = OptionElement.new(content, attributes)
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



145
146
147
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 145

def attributes
  @attributes
end

#contentObject (readonly)

Returns the value of attribute content.



144
145
146
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 144

def content
  @content
end

Instance Method Details

#_options(parent: nil, &condition) ⇒ Object



152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 152

def _options(parent: nil, &condition)
  parent ||= []

  if block_given?
    if yield(parent + [@element])
      [[@element]]
    else
      []
    end
  else
    [[@element]]
  end
end