Class: Stretto::Tokens::VariableDefinitionToken

Inherits:
HashToken
  • Object
show all
Defined in:
lib/stretto/grammar/tokens/variable_definition_token.rb

Overview

Token from parsing a variable definition

Examples:

“$MY_VAR=80”, “$OTHER_VAR=

Instance Method Summary collapse

Methods inherited from HashToken

#[]

Instance Method Details

#nameString

Returns The name of the variable.

Returns:

  • (String)

    The name of the variable



17
18
19
# File 'lib/stretto/grammar/tokens/variable_definition_token.rb', line 17

def name
  __name.text_value
end

#to_stretto(pattern = nil) ⇒ MusicElements::Variable

Returns The constructed Variable element.

Returns:



12
13
14
# File 'lib/stretto/grammar/tokens/variable_definition_token.rb', line 12

def to_stretto(pattern = nil)
  Stretto::MusicElements::Variable.new(self, pattern)
end

#valueValue

Returns The value of the variable, a Value object wrapping either a numeric or another variable value.

Returns:

  • (Value)

    The value of the variable, a Value object wrapping either a numeric or another variable value



23
24
25
# File 'lib/stretto/grammar/tokens/variable_definition_token.rb', line 23

def value
  Stretto::Value.new(__value.wrap)
end