Sha256: 8cceac16fa56d94b14b385a69fbfeceecb4765168eb47663574ae3235f31ba02

Contents?: true

Size: 512 Bytes

Versions: 2

Compression:

Stored size: 512 Bytes

Contents

require 'schematic/generator/restrictions/base'

module Schematic
  module Generator
    module Restrictions
      class Length < Base
        def generate(builder)
          for_validator ActiveModel::Validations::LengthValidator do |validator|
            builder.xs(:maxLength, 'value' => validator.options[:maximum]) if validator.options[:maximum]
            builder.xs(:minLength, 'value' => validator.options[:minimum]) if validator.options[:minimum]
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
schematic-0.7.1 lib/schematic/generator/restrictions/length.rb
schematic-0.7.0 lib/schematic/generator/restrictions/length.rb