Sha256: 123e5b6bc4d45480232e8c909a180ec0aedd04532fd69812d526d8c6d019077e
Contents?: true
Size: 952 Bytes
Versions: 1
Compression:
Stored size: 952 Bytes
Contents
# -*- encoding: utf-8 -*- require 'aequitas/rule/length' module Aequitas class Rule class Length class Minimum < Length equalize_on *superclass.superclass.equalizer.keys + [:bound] attr_reader :bound def initialize(attribute_name, options) super @bound = options.fetch(:bound) end def violation_type(resource) :too_short end def violation_data(resource) [ [ :minimum, bound ] ] end # Validate the value length is greater than or equal to the bound # # @param [Integer] length # the value length # # @return [String, NilClass] # the error message if invalid, nil if valid # # @api private def valid_length?(length) bound <= length end end # class Minimum end # class Length end # class Rule end # module Aequitas
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aequitas-0.0.2 | lib/aequitas/rule/length/minimum.rb |