Module: Perm::HasAuthorizer

Extended by:
Forwardable
Defined in:
lib/perm/has_authorizer.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/perm/has_authorizer.rb', line 8

def self.included(mod)
  class << mod
    attr_reader :authorizer_class, :user_method
    def authorizes_with(klass, user_method)
      @authorizer_class = klass
      @user_method = user_method
    end
  end
end

Instance Method Details

#authorized_userObject



18
19
20
# File 'lib/perm/has_authorizer.rb', line 18

def authorized_user
  @authorized_user ||= authorizer_class.new(send(user_method))
end