lib/music-transcription/note.rb in music-transcription-0.7.2 vs lib/music-transcription/note.rb in music-transcription-0.7.3
- old
+ new
@@ -18,11 +18,13 @@
@check_methods = [ :ensure_positive_duration ]
end
def ensure_positive_duration
- raise ValueNotPositiveError, "duration #{@duration} is not positive" if @duration <= 0
+ unless @duration > 0
+ raise ValueNotPositiveError, "duration #{@duration} is not positive"
+ end
end
def == other
return (@duration == other.duration) &&
(self.pitches == other.pitches) &&
@@ -31,10 +33,14 @@
end
def clone
Marshal.load(Marshal.dump(self))
end
+
+ def clear_links
+ @links = {}
+ end
def transpose diff
self.clone.transpose! diff
end
@@ -58,13 +64,9 @@
end
def stretch! ratio
@duration *= ratio
return self
- end
-
- def valid?
- @duration > 0
end
class Sixteenth < Note
def initialize pitches = [], links: {}, accent: Accents::NONE
super(Rational(1,16),pitches,links:links,accent:accent)