Sha256: fe06fcba9343e3769f389f1e767215d185bb6eea66ec42dfdb4dd2c7216fa7d4

Contents?: true

Size: 589 Bytes

Versions: 1

Compression:

Stored size: 589 Bytes

Contents

module Judge

  class Validator

    attr_reader :active_model_validator, :kind, :options, :method, :messages

    REJECTED_OPTIONS = [:if, :on, :unless, :tokenizer, :scope, :case_sensitive, :judge]

    def initialize(object, method, amv)
      @kind     = amv.kind
      @options  = amv.options.reject { |key| REJECTED_OPTIONS.include?(key)  }
      @method   = method
      @messages = Judge::MessageCollection.new(object, method, amv)
    end

    def to_hash
      {
        :kind => kind,
        :options => options,
        :messages => messages.to_hash
      }
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
judge-2.0.5 lib/judge/validator.rb