class Referral::FiltersTokens
Public Instance Methods
call(tokens, options)
click to toggle source
# File lib/referral/filters_tokens.rb, line 51 def call(tokens, options) filters = options.to_h.select { |opt_name, opt_val| FILTER_FUNCTIONS.key?(opt_name) && !opt_val.nil? } if !filters.empty? tokens.filter { |token| filters.all? { |(opt_name, opt_val)| FILTER_FUNCTIONS[opt_name].call(token, opt_val) } } else result end end