lib/music-transcription/program.rb in music-transcription-0.9.2 vs lib/music-transcription/program.rb in music-transcription-0.10.0
- old
+ new
@@ -8,22 +8,19 @@
class Program
include Validatable
attr_accessor :segments
- # A new instance of Program.
- # @param [Hash] args Hashed arguments. Required key is :segments.
+ @@check_methods = [:ensure_increasing_segments, :ensure_nonnegative_segments]
def initialize segments = []
@segments = segments
- @check_methods = [:ensure_increasing_segments, :ensure_nonnegative_segments]
end
# @return [Float] the sum of all program segment lengths
def length
segments.inject(0.0) { |length, segment| length + (segment.last - segment.first) }
end
- # compare to another Program
def == other
return other.respond_to?(:segments) && @segments == other.segments
end
def include? offset