class FluentValidation::Validators::InclusiveBetweenValidator

Public Class Methods

new(from, to) click to toggle source
# File lib/fluent_validation/validators/inclusive_between_validator.rb, line 6
def initialize(from, to)
  @from = from
  @to = to
end

Public Instance Methods

generate_failure_message(attribute_name, attribute_value) click to toggle source
# File lib/fluent_validation/validators/inclusive_between_validator.rb, line 15
def generate_failure_message(attribute_name, attribute_value)
  "#{attribute_name} must be between #{@from} and #{@to}. You entered #{attribute_value}."
end
is_valid?(validator_context) click to toggle source
# File lib/fluent_validation/validators/inclusive_between_validator.rb, line 11
def is_valid?(validator_context)
  validator_context.attribute_value >=@from && validator_context.attribute_value <= @to
end