module HalApi::Controller::Filtering::ClassMethods

Public Instance Methods

filter_params(*args) click to toggle source
# File lib/hal_api/controller/filtering.rb, line 32
def filter_params(*args)
  self.allowed_filter_names = []
  self.allowed_filter_types = {}
  (args || []).map do |arg|
    if arg.is_a? Hash
      arg.to_a.each { |key, val| add_filter_param(key.to_s, val.to_s) }
    else
      add_filter_param(arg.to_s)
    end
  end
end

Private Instance Methods

add_filter_param(name, type = nil) click to toggle source
# File lib/hal_api/controller/filtering.rb, line 46
def add_filter_param(name, type = nil)
  unless allowed_filter_names.include? name
    allowed_filter_names << name
    allowed_filter_types[name] = type unless type.nil?
  end
end