lib/coltrane/theory/frequency.rb in coltrane-3.2.0 vs lib/coltrane/theory/frequency.rb in coltrane-3.3.0
- old
+ new
@@ -1,13 +1,18 @@
# frozen_string_literal: true
module Coltrane
module Theory
class Frequency
+ include Comparable
attr_reader :frequency
def initialize(frequency)
@frequency = frequency.to_f
+ end
+
+ def <=>(other)
+ to_f <=> other.to_f
end
class << self
alias [] new
end