Sha256: b8fae9b6f1a288983f738aaca8c17185006f2f86ad8a212903f1c8d4b7adf01a

Contents?: true

Size: 736 Bytes

Versions: 1

Compression:

Stored size: 736 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.downcase.to_sym}[#{@method}]"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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