lib/key_vortex/constraint/maximum.rb in key-vortex-0.1.4 vs lib/key_vortex/constraint/maximum.rb in key-vortex-0.2.0

- old
+ new

@@ -3,22 +3,26 @@ require "key_vortex/constraint/base" class KeyVortex class Constraint class Maximum < KeyVortex::Constraint::Base - attr_reader :value + attr_reader :limit - def initialize(value) + def initialize(limit) super() - @value = value + @limit = limit end def attribute :maximum end def within?(constraint) - super && value <= constraint.value + super && limit <= constraint.limit + end + + def accepts?(value) + value <= limit end end end end