class Music::Transcription::Change::Partial

Attributes

elapsed[R]
stop[R]
total_duration[R]

Public Class Methods

new(value, total_dur, elapsed, stop) click to toggle source
Calls superclass method Music::Transcription::Change::new
# File lib/music-transcription/model/change.rb, line 52
def initialize value, total_dur, elapsed, stop
  if elapsed < 0
    raise NegativeError, "elapsed (#{elapsed}) is < 0"
  end
  
  if stop <= 0
    raise NonPositiveError, "stop (#{stop}) is < 0"
  end

  if stop > total_dur
    raise ArgumentError, "stop (#{stop}) is > total duration (#{total_dur})"
  end
  
  if stop <= elapsed
    raise ArgumentError, "stop (#{stop}) is <= elapsed (#{elapsed})"
  end

  @total_duration = total_dur
  @elapsed = elapsed
  @stop = stop
  super(value,stop - elapsed)
end

Public Instance Methods

==(other) click to toggle source
Calls superclass method Music::Transcription::Change#==
# File lib/music-transcription/model/change.rb, line 75
def ==(other)
  super() &&
  @elapsed == other.elapsed &&
  @stop == other.stop
end