Parent

Class/Module Index [+]

Quicksearch

Shoulda::Matchers::ActiveModel::NumericalityMatchers::ComparisonMatcher

@private

Constants

ERROR_MESSAGES

Public Class Methods

new(numericality_matcher, value, operator) click to toggle source
# File lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb, line 15
def initialize(numericality_matcher, value, operator)
  unless numericality_matcher.respond_to? :diff_to_compare
    raise ArgumentError, 'numericality_matcher is invalid'
  end
  @numericality_matcher = numericality_matcher
  @value = value
  @operator = operator
  @message = ERROR_MESSAGES[operator]
  @comparison_combos = comparison_combos
  @strict = false
end

Public Instance Methods

comparison_description() click to toggle source
# File lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb, line 41
def comparison_description
  "#{expectation} #{@value}"
end
for(attribute) click to toggle source
# File lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb, line 27
def for(attribute)
  @attribute = attribute
  self
end
matches?(subject) click to toggle source
# File lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb, line 32
def matches?(subject)
  @subject = subject
  all_bounds_correct?
end
with_message(message) click to toggle source
# File lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb, line 37
def with_message(message)
  @message = message
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.