Sha256: c751cd3120ebc57ad6226efedbc89c8a35f131b4d7ba5b470ac7760d047e8586

Contents?: true

Size: 798 Bytes

Versions: 4

Compression:

Stored size: 798 Bytes

Contents

module BootstrapValidatorRails
  module Validators
    class Length
      def initialize(record, method, validator)
        @record, @method, @validator = record, method, validator
      end

      def generate_data
        data = {}
        options = @validator.options
        
        data[:bv_stringlength] = 'true'

        if options[:minimum]
          data[:bv_stringlength_min] = options[:minimum] 
        end

        if options[:maximum]
          data[:bv_stringlength_max] = options[:maximum] 
        end

        if options[:is]
          data[:bv_stringlength_minimum] = options[:is] 
          data[:bv_stringlength_maximum] = options[:is] 
          data[:bv_stringlength_message] = @record.errors.generate_message(@method) 
        end

        data
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bootstrap_validator_rails-0.4.1 lib/bootstrap_validator_rails/validators/length_validator.rb
bootstrap_validator_rails-0.4.0 lib/bootstrap_validator_rails/validators/length_validator.rb
bootstrap_validator_rails-0.3.0 lib/bootstrap_validator_rails/validators/length_validator.rb
bootstrap_validator_rails-0.2.0 lib/bootstrap_validator_rails/validators/length_validator.rb