Class: Music::Transcription::Change::Partial
- Inherits:
-
Music::Transcription::Change
- Object
- Music::Transcription::Change
- Music::Transcription::Change::Partial
- Defined in:
- lib/music-transcription/model/change.rb
Instance Attribute Summary collapse
-
#elapsed ⇒ Object
readonly
Returns the value of attribute elapsed.
-
#stop ⇒ Object
readonly
Returns the value of attribute stop.
-
#total_duration ⇒ Object
readonly
Returns the value of attribute total_duration.
Attributes inherited from Music::Transcription::Change
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(value, total_dur, elapsed, stop) ⇒ Partial
constructor
A new instance of Partial.
Methods inherited from Music::Transcription::Change
Constructor Details
#initialize(value, total_dur, elapsed, stop) ⇒ Partial
Returns a new instance of Partial.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# 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 |
Instance Attribute Details
#elapsed ⇒ Object (readonly)
Returns the value of attribute elapsed.
50 51 52 |
# File 'lib/music-transcription/model/change.rb', line 50 def elapsed @elapsed end |
#stop ⇒ Object (readonly)
Returns the value of attribute stop.
50 51 52 |
# File 'lib/music-transcription/model/change.rb', line 50 def stop @stop end |
#total_duration ⇒ Object (readonly)
Returns the value of attribute total_duration.
50 51 52 |
# File 'lib/music-transcription/model/change.rb', line 50 def total_duration @total_duration end |
Instance Method Details
#==(other) ⇒ Object
75 76 77 78 79 |
# File 'lib/music-transcription/model/change.rb', line 75 def ==(other) super() && @elapsed == other.elapsed && @stop == other.stop end |