Class: Pageflow::Admin::AdminOnlyTabPolicy
- Inherits:
-
Object
- Object
- Pageflow::Admin::AdminOnlyTabPolicy
- Defined in:
- app/policies/pageflow/admin/admin_only_tab_policy.rb
Overview
Instance Attribute Summary collapse
- #tab ⇒ Object readonly
- #user ⇒ Object readonly
Instance Method Summary collapse
-
#initialize(user, tab) ⇒ AdminOnlyTabPolicy
constructor
A new instance of AdminOnlyTabPolicy.
- #see? ⇒ Boolean
Constructor Details
#initialize(user, tab) ⇒ AdminOnlyTabPolicy
Returns a new instance of AdminOnlyTabPolicy.
6 7 8 9 |
# File 'app/policies/pageflow/admin/admin_only_tab_policy.rb', line 6 def initialize(user, tab) @user = user @tab = tab end |
Instance Attribute Details
#tab ⇒ Object (readonly)
4 5 6 |
# File 'app/policies/pageflow/admin/admin_only_tab_policy.rb', line 4 def tab @tab end |
#user ⇒ Object (readonly)
4 5 6 |
# File 'app/policies/pageflow/admin/admin_only_tab_policy.rb', line 4 def user @user end |
Instance Method Details
#see? ⇒ Boolean
11 12 13 |
# File 'app/policies/pageflow/admin/admin_only_tab_policy.rb', line 11 def see? !tab.admin_only? || user.admin? end |