lib/xi/scale.rb in xi-lang-0.2.1 vs lib/xi/scale.rb in xi-lang-0.2.2

- old
+ new

@@ -1,6 +1,10 @@ +require 'forwardable' + class Xi::Scale + extend Forwardable + DEGREES = { # TWELVE TONES PER OCTAVE # 5 note scales minorPentatonic: [0,3,5,7,10], majorPentatonic: [0,2,4,7,9], @@ -89,9 +93,25 @@ chromatic: (0..11).to_a, } class << self DEGREES.each do |name, list| - define_method(name) { list } + define_method(name) { self.new(list) } end end + + attr_reader :notes + + def initialize(notes) + @notes = notes + end + + def_delegators :@notes, :size, :[], :to_a, :first + + def p(*delta, **metadata) + [@notes].p(*delta, **metadata) + end + + #def size + #@notes.size + #end end