Class: Stretto::MusicElements::Rest

Inherits:
MusicElement show all
Includes:
Duration
Defined in:
lib/stretto/music_elements/rest.rb

Overview

Represents a rest.

Is represented by an "R", followed by a duration modifier (see Duration)

Constant Summary

Constant Summary

Constants included from Duration

Duration::DEFAULT_DURATION, Duration::DEFAULT_TUPLET_DENOMINATOR, Duration::DEFAULT_TUPLET_NUMERATOR, Duration::DURATIONS

Instance Attribute Summary collapse

Attributes included from Duration

#end_tie, #start_tie

Attributes inherited from MusicElement

#original_string, #pattern

Attributes included from Node

#next, #prev

Instance Method Summary collapse

Methods included from Duration

#build_duration_from_token, #duration, #end_of_tie?, parse_duration, #start_of_tie?, #tied_duration, #tied_elements

Methods inherited from MusicElement

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

Constructor Details

#initialize(string_or_options, pattern = nil) ⇒ Rest

Returns a new instance of Rest



15
16
17
18
19
20
21
22
# File 'lib/stretto/music_elements/rest.rb', line 15

def initialize(string_or_options, pattern = nil)
  token = case string_or_options
    when String then Stretto::Parser.parse_rest!(string_or_options)
    else string_or_options
  end
  super(token[:text_value], pattern)
  build_duration_from_token(token[:duration])
end

Instance Attribute Details

#original_durationObject (readonly)

Returns the value of attribute original_duration



13
14
15
# File 'lib/stretto/music_elements/rest.rb', line 13

def original_duration
  @original_duration
end