class InputSanitizer::V2::QuerySanitizer

Public Class Methods

converters() click to toggle source
# File lib/input_sanitizer/v2/query_sanitizer.rb, line 2
def self.converters
  {
    :integer => InputSanitizer::V2::Types::CoercingIntegerCheck.new,
    :float => InputSanitizer::V2::Types::CoercingFloatCheck.new,
    :string => InputSanitizer::V2::Types::StringCheck.new,
    :boolean => InputSanitizer::V2::Types::CoercingBooleanCheck.new,
    :datetime => InputSanitizer::V2::Types::DatetimeCheck.new,
    :date => InputSanitizer::V2::Types::DatetimeCheck.new(:check_date => true),
    :url => InputSanitizer::V2::Types::URLCheck.new,
  }
end
sort_by(allowed_values, options = {}) click to toggle source
# File lib/input_sanitizer/v2/query_sanitizer.rb, line 15
def self.sort_by(allowed_values, options = {})
  set_keys_to_converter([:sort_by, { :allow => allowed_values }.merge(options)], InputSanitizer::V2::Types::SortByCheck.new)
end

Private Instance Methods

perform_clean() click to toggle source
# File lib/input_sanitizer/v2/query_sanitizer.rb, line 23
def perform_clean
  super
  @errors.each do |error|
    error.field = error.field[1..-1] if error.field.start_with?('/')
  end
end
sanitizer_type() click to toggle source
# File lib/input_sanitizer/v2/query_sanitizer.rb, line 30
def sanitizer_type
  :query
end