class Merit::TargetFinder
Public Class Methods
find(*args)
click to toggle source
# File lib/merit/target_finder.rb, line 3 def self.find(*args) new(*args).find end
Public Instance Methods
find()
click to toggle source
# File lib/merit/target_finder.rb, line 7 def find target = case rule.to when :itself then base_target when :action_user then action_user else other_target end Array.wrap(target) end
Private Instance Methods
action_user()
click to toggle source
# File lib/merit/target_finder.rb, line 25 def action_user user = Merit.user_model.find_by_id action.user_id if user.nil? user_model = Merit.user_model str = "[merit] no #{user_model} found with id #{action.user_id}" Rails.logger.warn str end user end
base_target()
click to toggle source
# File lib/merit/target_finder.rb, line 21 def base_target BaseTargetFinder.find rule, action end
other_target()
click to toggle source
# File lib/merit/target_finder.rb, line 35 def other_target base_target.send rule.to rescue NoMethodError str = "[merit] NoMethodError on `#{base_target.class.name}##{rule.to}`" \ ' (called from Merit::TargetFinder#other_target)' Rails.logger.warn str end