require 'constraint' class TimeConstraint < Constraint attr_accessor :time defaultable_attribute :operator defaultable_attribute :attribute def initialize(time, operator = nil, attribute = nil) @time = time @default_operator = operator.nil? @operator = operator @default_attribute = attribute.nil? @attribute = attribute || "start_time" end def to_s "#{@attribute} #{@operator} #{@time}" end def inspect "Time<#{to_s}>" end def eql?(b) b.is_a?(TimeConstraint) && @operator == b.operator && @time == b.time && @attribute == b.attribute end end