Class: Stretto::Tokens::KeySignatureToken

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

Overview

Token result from parsing a key signature

Examples:

“KGmaj”

Instance Method Summary collapse

Methods inherited from HashToken

#[]

Instance Method Details

#keyObject

Returns A string with the key.

Examples:

“C#”

Returns:

  • A string with the key



18
19
20
# File 'lib/stretto/grammar/tokens/key_signature_token.rb', line 18

def key
  __note_key.text_value
end

#scale'maj', 'min'

Returns The scale of the key signature.

Returns:

  • ('maj', 'min')

    The scale of the key signature



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

def scale
  __scale.text_value
end

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

Returns The constructed token.

Returns:



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

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