Module: Authority::Abilities::ClassMethods

Includes:
Definitions
Defined in:
lib/authority/abilities.rb

Instance Method Summary collapse

Instance Method Details

#authorizerClass

Returns of the designated authorizer.

Returns:

  • (Class)

    of the designated authorizer



50
51
52
53
54
55
56
# File 'lib/authority/abilities.rb', line 50

def authorizer
  @authorizer ||= authorizer_name.constantize # Get an actual reference to the authorizer class
rescue NameError
  raise Authority::NoAuthorizerError.new(
            "#{authorizer_name} is set as the authorizer for #{self}, but the constant is missing"
        )
end

#authorizer=(authorizer_class) ⇒ Object



44
45
46
47
# File 'lib/authority/abilities.rb', line 44

def authorizer=(authorizer_class)
  @authorizer          = authorizer_class
  self.authorizer_name = @authorizer.name
end