Class: Stretto::MusicElements::LayerChange

Inherits:
MusicElement show all
Defined in:
lib/stretto/music_elements/layer_change.rb

Constant Summary collapse

MAX_LAYERS =
15

Instance Attribute Summary collapse

Attributes inherited from MusicElement

#original_string, #pattern

Attributes included from Node

#next, #prev

Instance Method Summary collapse

Methods inherited from MusicElement

#build_music_string, #duration, #end_of_tie?, #start_of_tie?, #to_s

Constructor Details

#initialize(string_or_options, pattern = nil) ⇒ LayerChange

Returns a new instance of LayerChange.



12
13
14
15
16
17
18
19
# File 'lib/stretto/music_elements/layer_change.rb', line 12

def initialize(string_or_options, pattern = nil)
  token = case string_or_options
    when String then Stretto::Parser.parse_layer_change!(string_or_options)
    else string_or_options
  end
  super(token[:text_value], pattern)
  @original_value = token[:value]
end

Instance Attribute Details

#indexObject

Returns the value of attribute index.



10
11
12
# File 'lib/stretto/music_elements/layer_change.rb', line 10

def index
  @index
end

Instance Method Details

#substitute_variables!Object



32
33
34
# File 'lib/stretto/music_elements/layer_change.rb', line 32

def substitute_variables!
  self.index = index
end