Sha256: fb611309da785fa827d73b84ea7a90b94e65418449b0c4b92acee7384978a487

Contents?: true

Size: 314 Bytes

Versions: 7

Compression:

Stored size: 314 Bytes

Contents

module Compel
  module Validation

    class MinLength < Condition

      def validate_value
        unless valid?
          "cannot have length less than #{option_value}"
        end
      end

      private

      def valid?
        !value.nil? && option_value <= "#{value}".length
      end

    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
compel-0.5.0 lib/compel/validation/conditions/min_length.rb
compel-0.4.3 lib/compel/validation/conditions/min_length.rb
compel-0.4.2 lib/compel/validation/conditions/min_length.rb
compel-0.4.0 lib/compel/validation/conditions/min_length.rb
compel-0.3.7 lib/compel/validation/conditions/min_length.rb
compel-0.3.6 lib/compel/validation/conditions/min_length.rb
compel-0.3.4 lib/compel/validation/conditions/min_length.rb