lib/music-transcription/model/change.rb in music-transcription-0.17.1 vs lib/music-transcription/model/change.rb in music-transcription-0.19.0
- old
+ new
@@ -15,28 +15,34 @@
self.duration == other.duration
end
class Immediate < Change
include Validatable
-
- @@check_methods = [ :ensure_zero_duration ]
+
def initialize value
super(value,0)
end
+ def check_methods
+ [ :ensure_zero_duration ]
+ end
+
def ensure_zero_duration
unless @duration == 0
raise NonZeroError, "immediate change duration #{self.duration} must be 0"
end
end
end
class Gradual < Change
include Validatable
- @@check_methods = [ :ensure_nonnegative_duration ]
def initialize value, transition_duration
super(value, transition_duration)
+ end
+
+ def check_methods
+ [ :ensure_nonnegative_duration ]
end
def ensure_nonnegative_duration
if @duration < 0
raise NegativeError, "gradual change duration #{self.duration} must be non-negative"
\ No newline at end of file