lib/head_music/circle.rb in head_music-0.22.0 vs lib/head_music/circle.rb in head_music-0.23.0
- old
+ new
@@ -18,22 +18,22 @@
end
attr_reader :interval, :pitch_classes
def initialize(interval)
- @interval = HeadMusic::Interval.get(interval.to_i)
- @pitch_classes = pitch_classes_by_interval(interval)
+ @interval = interval.to_i
+ @pitch_classes = pitch_classes_by_interval
end
def index(pitch_class)
@pitch_classes.index(HeadMusic::Spelling.get(pitch_class).pitch_class)
end
private_class_method :new
private
- def pitch_classes_by_interval(interval)
+ def pitch_classes_by_interval
[HeadMusic::PitchClass.get(0)].tap do |list|
loop do
next_pitch_class = list.last + interval
break if next_pitch_class == list.first