Module: Authegy

Defined in:
lib/authegy.rb,
lib/authegy/engine.rb,
lib/authegy/version.rb,
lib/authegy/models/role.rb,
lib/authegy/models/user.rb,
lib/authegy/authorizable.rb,
lib/authegy/models/person.rb,
lib/authegy/controller_helpers.rb,
app/jobs/authegy/application_job.rb,
lib/authegy/models/role_assignment.rb,
lib/generators/authegy/orm_helpers.rb,
app/models/authegy/application_record.rb,
app/helpers/authegy/application_helper.rb,
app/mailers/authegy/application_mailer.rb,
app/controllers/authegy/application_controller.rb

Defined Under Namespace

Modules: ApplicationHelper, Authorizable, ControllerHelpers, Generators Classes: ApplicationController, ApplicationJob, ApplicationMailer, ApplicationRecord, Engine, Person, Role, RoleAssignment, User

Constant Summary collapse

VERSION =
'0.0.3'.freeze

Class Method Summary collapse

Class Method Details

.extract_resource_attributes(resource_type_or_instance) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/authegy.rb', line 15

def self.extract_resource_attributes(resource_type_or_instance)
  return { resource_type: resource_type_or_instance } \
    if resource_type_or_instance.is_a? String

  return { resource_type: resource_type_or_instance.name } \
    if resource_type_or_instance.is_a? Class

  return {
    resource_type: resource_type_or_instance.class.name,
    resource_id: resource_type_or_instance.id
  } if resource_type_or_instance.respond_to? :id
end