Module: Jets::Router::Route::Authorizer::ModuleMethods

Included in:
Jets::Router::Route::Authorizer, Jets::Router::Route::Authorizer
Defined in:
lib/jets/router/route/authorizer.rb

Instance Method Summary collapse

Instance Method Details

#logical_id(authorizer, prefix_class: true) ⇒ Object



32
33
34
35
36
37
# File 'lib/jets/router/route/authorizer.rb', line 32

def logical_id(authorizer, prefix_class: true)
  klass, meth = authorizer.split("#")
  words = [meth, "authorizer"]
  words.unshift(klass) if prefix_class
  words.join('_').camelize # logical_id
end

#metadata(authorizer) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/jets/router/route/authorizer.rb', line 39

def (authorizer)
  klass = authorizer.split("#").first
  authorizer_class = "#{klass}_authorizer".camelize
  logical_id = logical_id(authorizer, prefix_class: false)
  # IE: MainAuthorizer.ProtectAuthorizer
  "#{authorizer_class}.#{logical_id}"
end