lib/coltrane/theory/pitch.rb in coltrane-3.2.0 vs lib/coltrane/theory/pitch.rb in coltrane-3.3.0

- old
+ new

@@ -2,10 +2,11 @@ module Coltrane module Theory # It describes a pitch, like E4 or Bb5. It's like a note, but it has an octave class Pitch + include Comparable attr_reader :integer def initialize(notation_arg = nil, note: nil, octave: nil, @@ -25,9 +26,13 @@ end end def self.[](*args) new *args + end + + def <=>(other) + integer <=> other.integer end def scientific_notation "#{pitch_class}#{octave}" end