Class: Merit::TargetFinder

Inherits:
Struct
  • Object
show all
Defined in:
lib/merit/target_finder.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actionObject

Returns the value of attribute action

Returns:

  • (Object)

    the current value of action



2
3
4
# File 'lib/merit/target_finder.rb', line 2

def action
  @action
end

#ruleObject

Returns the value of attribute rule

Returns:

  • (Object)

    the current value of rule



2
3
4
# File 'lib/merit/target_finder.rb', line 2

def rule
  @rule
end

Class Method Details

.find(*args) ⇒ Object



3
4
5
# File 'lib/merit/target_finder.rb', line 3

def self.find(*args)
  new(*args).find
end

Instance Method Details

#findObject



7
8
9
10
11
12
13
14
15
16
17
# 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