Method: PublicActivity.resolve_value

Defined in:
lib/public_activity/common.rb

.resolve_value(context, thing) ⇒ Object

Used to smartly transform value from metadata to data. Accepts Symbols, which it will send against context. Accepts Procs, which it will execute with controller and context.

Since:

  • 0.4.0

[View source]

11
12
13
14
15
16
17
18
19
20
# File 'lib/public_activity/common.rb', line 11

def self.resolve_value(context, thing)
  case thing
  when Symbol
    context.__send__(thing)
  when Proc
    thing.call(PublicActivity.get_controller, context)
  else
    thing
  end
end