class Shoulda::Lotus::Matchers::Matcher

Public Class Methods

new(target, attribute, validation) click to toggle source
# File lib/shoulda/lotus/matchers.rb, line 11
def initialize(target, attribute, validation)
  @target = target
  @attribute = attribute
  @validation = validation
end

Public Instance Methods

matches?() click to toggle source
# File lib/shoulda/lotus/matchers.rb, line 17
def matches?
  @target.valid?
  @target.errors.for(@attribute).select { |error| error.attribute == @attribute.to_s && error.validation == @validation }.size > 0
end