Class: Ramekin::CombinedRestEvent

Inherits:
NoteEvent show all
Defined in:
lib/ramekin/note_aggregator.rb

Constant Summary

Constants inherited from NoteEvent

NoteEvent::NOTES

Instance Attribute Summary collapse

Attributes inherited from NoteEvent

#extensions, #note, #octave

Attributes inherited from Element

#channel, #components, #macro_stack, #start_tick

Instance Method Summary collapse

Methods inherited from NoteEvent

#default_error_location, #default_length, #inspect, #length_amk, #note_hex, #note_name, #octave_amk, #octave_num, #octave_switching_amk, #repr, #to_amk

Methods inherited from Element

make

Constructor Details

#initialize(rests) ⇒ CombinedRestEvent

Returns a new instance of CombinedRestEvent.



146
147
148
149
# File 'lib/ramekin/note_aggregator.rb', line 146

def initialize(rests)
  @rests = rests
  error! "empty CombinedRestEvent" if rests.empty?
end

Instance Attribute Details

#restsObject (readonly)

Returns the value of attribute rests.



145
146
147
# File 'lib/ramekin/note_aggregator.rb', line 145

def rests
  @rests
end

Instance Method Details

#finObject



163
164
165
# File 'lib/ramekin/note_aggregator.rb', line 163

def fin
  @rests.last.fin
end

#metaObject



155
156
157
# File 'lib/ramekin/note_aggregator.rb', line 155

def meta
  @rests.first.meta
end

#rest?Boolean

Returns:

  • (Boolean)


167
168
169
# File 'lib/ramekin/note_aggregator.rb', line 167

def rest?
  true
end

#startObject



159
160
161
# File 'lib/ramekin/note_aggregator.rb', line 159

def start
  @rests.first.start
end

#ticksObject



171
172
173
# File 'lib/ramekin/note_aggregator.rb', line 171

def ticks
  @rests.map(&:ticks).sum
end

#tie?Boolean

Returns:

  • (Boolean)


151
152
153
# File 'lib/ramekin/note_aggregator.rb', line 151

def tie?
  false
end