class Song include Comparable def initialize(name, duration) @name = name @duration = duration end def <(other) self.duration < other.duration end def <=>(other) self.duration <=> other.duration end def to_s "#{@name} is #{@duration} seconds long" end end song1 = Song.new("Pauls Song", 101) song2 = Song.new("Saras Song", 100) puts song1 < song2