class Musicality::ScaleClass
Public Class Methods
new(intervals)
click to toggle source
# File lib/musicality/composition/model/scale_class.rb, line 6 def initialize intervals if intervals.detect {|x| x <= 0 } raise NonPositiveError, "One or more scale intervals (#{intervals}) is non-positive" end @intervals = intervals end
Public Instance Methods
==(other)
click to toggle source
# File lib/musicality/composition/model/scale_class.rb, line 15 def ==(other) self.entries == other.entries end
each() { |x| ... }
click to toggle source
# File lib/musicality/composition/model/scale_class.rb, line 19 def each return @intervals.each unless block_given? @intervals.each {|x| yield x } end
intervals()
click to toggle source
# File lib/musicality/composition/model/scale_class.rb, line 13 def intervals; self.entries; end
rotate(n = 1)
click to toggle source
# File lib/musicality/composition/model/scale_class.rb, line 32 def rotate n = 1 ScaleClass.new(@intervals.rotate(n)) end
to_pitch_seq(start_pitch)
click to toggle source
# File lib/musicality/composition/model/scale_class.rb, line 24 def to_pitch_seq start_pitch AddingSequence.new(@intervals, start_pitch) end
to_scale(pitch_class)
click to toggle source
# File lib/musicality/composition/model/scale_class.rb, line 28 def to_scale pitch_class Scale.new(pitch_class, @intervals) end