Sha256: eb822b304eafce91330f29e158e602643254335025b26858609f4861085cd74f

Contents?: true

Size: 316 Bytes

Versions: 8

Compression:

Stored size: 316 Bytes

Contents

module Compel
  module Validation

    class Length < Condition

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

      private

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

    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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