class CouchRest::Validation::MethodValidator

@author Guy van den Berg @since 0.9

Public Instance Methods

==(other) click to toggle source
# File lib/couchrest/validation/validators/method_validator.rb, line 45
def ==(other)
  @options[:method] == other.instance_variable_get(:@options)[:method] && super
end
call(target) click to toggle source
# File lib/couchrest/validation/validators/method_validator.rb, line 39
def call(target)
  result, message = target.send(@options[:method])
  add_error(target, message, field_name) unless result
  result
end

Public Class Methods

new(field_name, options={}) click to toggle source
# File lib/couchrest/validation/validators/method_validator.rb, line 33
def initialize(field_name, options={})
  super
  @field_name, @options = field_name, options.clone
  @options[:method] = @field_name unless @options.has_key?(:method)
end