class SunspotMatchers::OrderByMatcher

Public Instance Methods

args() click to toggle source
# File lib/sunspot_matchers/matchers.rb, line 252
def args
  return @args unless direction_wildcard?
  @args[0...-1] + [:asc]
end
direction_wildcard?() click to toggle source
# File lib/sunspot_matchers/matchers.rb, line 248
def direction_wildcard?
  @args.length == 2 && @args.last == any_param
end
field_wildcard?() click to toggle source
# File lib/sunspot_matchers/matchers.rb, line 244
def field_wildcard?
  @args.first == any_param
end
keys_to_compare() click to toggle source
# File lib/sunspot_matchers/matchers.rb, line 233
def keys_to_compare
  [:sort]
end
search_method() click to toggle source
# File lib/sunspot_matchers/matchers.rb, line 229
def search_method
  :order_by
end
wildcard_matcher_for_keys() click to toggle source
# File lib/sunspot_matchers/matchers.rb, line 237
def wildcard_matcher_for_keys
  return {:sort => /./} if field_wildcard?
  param = comparison_params[:sort]
  regex = Regexp.new(param.gsub(any_param, '.*'))
  {:sort => regex}
end