lib/music-transcription/change.rb in music-transcription-0.5.11 vs lib/music-transcription/change.rb in music-transcription-0.6.0
- old
+ new
@@ -1,27 +1,34 @@
module Music
module Transcription
class Change
- attr_accessor :value
+ attr_accessor :value, :duration
- def initialize value
+ def initialize value, duration
@value = value
+ @duration = duration
+
+ unless duration >= 0
+ raise ArgumentError, "duration #{duration} must be >= 0"
+ end
end
def ==(other)
- self.class == other.class && self.value == other.value
+ self.class == other.class &&
+ self.value == other.value &&
+ self.duration == other.duration
end
class Immediate < Change
def initialize value
- super(value)
+ super(value,0)
end
end
class Gradual < Change
- def initialize value
- super(value)
+ def initialize value, transition_duration
+ super(value, transition_duration)
end
end
end
end
\ No newline at end of file