Challenge 2: Comparable in Practice — Solution class Temperature include Comparable attr_reader :celsius def initialize(celsius) @celsius = celsius end def <=>(other) celsius <=> other.celsius end end freezing = Temperature.new(0) room = Temperature.new(21) boiling = Temperature.new(100) puts freezing < room puts boiling > room puts room.between?(freezing, boiling) =begin Output: true true true Notes: - <=> is the only comparison method actually written by hand — it compares two Temperature instances by delegating straight to their underlying celsius values' own <=>. - include Comparable mixes in <, >, <=, >=, ==, between?, and clamp, all implemented internally in terms of whatever <=> returns. - freezing < room, boiling > room, and room.between?(...) all work correctly despite none of those three methods being defined anywhere in the Temperature class itself — they're entirely supplied by Comparable. =end