Sha256: 6e7bb1897b223b9e27cd2cd672d1f86e82dd429b46113ab9e2ae0af1d716d8a3

Contents?: true

Size: 738 Bytes

Versions: 1

Compression:

Stored size: 738 Bytes

Contents

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

      def validator_options
        options = @validator.try(:options) 
        options || {}
      end

      def generate_object(options = {})
        options
      end

      def unsupported?
        options = validator_options
        unsupported_options.any? { |opt| options.has_key? opt }
      end

      protected
      def unsupported_options
        BootstrapValidatorRails::CONFIGURATION[:unsupported_options]
      end

      def method_key
        "#{@record.class.to_s.underscore.to_sym}[#{@method}]"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bootstrap_validator_rails-0.7.0 lib/bootstrap_validator_rails/validators/validator.rb