class Interval def initialize(min = Float::INFINITY, max = -Float::INFINITY) @min = min @max = max end attr_reader :min, :max def size @max - @min end def include?(x) min <= x && x <= max end def surround?(x) min < x && x < max end end