Sha256: c35f5492601d93157e61582176e9338a37b02db4cd3952f3dfaf888e78c9426d

Contents?: true

Size: 465 Bytes

Versions: 6

Compression:

Stored size: 465 Bytes

Contents

# frozen_string_literal: true

require "key_vortex/constraint/base"

class KeyVortex
  class Constraint
    class Maximum < KeyVortex::Constraint::Base
      attr_reader :limit

      def initialize(limit)
        super()
        @limit = limit
      end

      def attribute
        :maximum
      end

      def within?(constraint)
        super && limit <= constraint.limit
      end

      def accepts?(value)
        value <= limit
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
key-vortex-0.2.5 lib/key_vortex/constraint/maximum.rb
key-vortex-0.2.4 lib/key_vortex/constraint/maximum.rb
key-vortex-0.2.3 lib/key_vortex/constraint/maximum.rb
key-vortex-0.2.2 lib/key_vortex/constraint/maximum.rb
key-vortex-0.2.1 lib/key_vortex/constraint/maximum.rb
key-vortex-0.2.0 lib/key_vortex/constraint/maximum.rb