Module: AuthAssistant::Helpers::UserRole

Defined in:
lib/auth_assistant/helpers/user_role.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



28
29
30
# File 'lib/auth_assistant/helpers/user_role.rb', line 28

def self.included(base)
  base.helper_method :user_block, :not_user_block, :user_area, :not_user_area, :user? 
end

Instance Method Details

#not_user_area(&block) ⇒ Object



10
11
12
13
14
# File 'lib/auth_assistant/helpers/user_role.rb', line 10

def not_user_area(&block)
  not_user_block do
    do_user_area(&block)
  end
end

#not_user_block(&block) ⇒ Object



20
21
22
# File 'lib/auth_assistant/helpers/user_role.rb', line 20

def not_user_block(&block)
  with_output_buffer(&block) if !user? 
end

#user?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/auth_assistant/helpers/user_role.rb', line 24

def user?
  devise_user? || cancan_user?
end

#user_area(&block) ⇒ Object



4
5
6
7
8
# File 'lib/auth_assistant/helpers/user_role.rb', line 4

def user_area(&block)
  user_block do
    do_user_area(&block)
  end
end

#user_block(&block) ⇒ Object



16
17
18
# File 'lib/auth_assistant/helpers/user_role.rb', line 16

def user_block(&block)
  with_output_buffer(&block) if user? 
end