class RailsParam::Validator::In

Public Instance Methods

valid_value?() click to toggle source
# File lib/rails_param/validator/in.rb, line 4
def valid_value?
  value.nil? || case options[:in]
                when Range
                  options[:in].include?(value)
                else
                  Array(options[:in]).include?(value)
                end
end

Private Instance Methods

error_message() click to toggle source
# File lib/rails_param/validator/in.rb, line 15
def error_message
  "Parameter #{parameter.name} must be within #{parameter.options[:in]}"
end