Method: Trailblazer::Macro::IdFor.from_callable

Defined in:
lib/trailblazer/macro.rb

.from_callable(user_proc, hint: nil) ⇒ Object



62
63
64
65
66
67
68
69
70
# File 'lib/trailblazer/macro.rb', line 62

def from_callable(user_proc, hint: nil)
  if user_proc.is_a?(Class)
    user_proc.to_s
  elsif user_proc.instance_of?(Method)
    "method(:#{user_proc.name})"
  else
    hint || rand(4)
  end
end