Ruby - Modules and Mixins
What will be the output of this Ruby code?
class Box
include Comparable
attr_reader :volume
def initialize(volume)
@volume = volume
end
def <=>(other)
volume <=> other.volume
end
end
box1 = Box.new(10)
box2 = Box.new(20)
puts box1 < box2