Sha256: d27e2078d4661baffdf46d97493756ea638f364da5b10ae061f0ff9d637592c6

Contents?: true

Size: 393 Bytes

Versions: 2

Compression:

Stored size: 393 Bytes

Contents

require 'jschematic/element'

module Jschematic
  module Attributes
    class Maximum
      include Jschematic::Element

      attr_reader :maximum

      def initialize(maximum)
        @maximum = maximum
      end

      def accepts?(number)
        return true unless Numeric === number

        (number <= maximum) || fail_validation!("<= #{@maximum}", number)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jschematic-0.1.0 lib/jschematic/attributes/maximum.rb
jschematic-0.0.9 lib/jschematic/attributes/maximum.rb