Class: Godmin::Authorization::Policy
- Inherits:
-
Object
- Object
- Godmin::Authorization::Policy
- Defined in:
- lib/godmin/authorization/policy.rb
Instance Attribute Summary collapse
-
#record ⇒ Object
readonly
Returns the value of attribute record.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #create? ⇒ Boolean
- #destroy? ⇒ Boolean
- #edit? ⇒ Boolean
- #index? ⇒ Boolean
-
#initialize(user, record, default: false) ⇒ Policy
constructor
A new instance of Policy.
- #new? ⇒ Boolean
- #show? ⇒ Boolean
- #update? ⇒ Boolean
Constructor Details
#initialize(user, record, default: false) ⇒ Policy
Returns a new instance of Policy.
6 7 8 9 10 |
# File 'lib/godmin/authorization/policy.rb', line 6 def initialize(user, record, default: false) @user = user @record = record @default = default end |
Instance Attribute Details
#record ⇒ Object (readonly)
Returns the value of attribute record.
4 5 6 |
# File 'lib/godmin/authorization/policy.rb', line 4 def record @record end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
4 5 6 |
# File 'lib/godmin/authorization/policy.rb', line 4 def user @user end |
Instance Method Details
#create? ⇒ Boolean
28 29 30 |
# File 'lib/godmin/authorization/policy.rb', line 28 def create? @default end |
#destroy? ⇒ Boolean
36 37 38 |
# File 'lib/godmin/authorization/policy.rb', line 36 def destroy? @default end |
#edit? ⇒ Boolean
24 25 26 |
# File 'lib/godmin/authorization/policy.rb', line 24 def edit? update? end |
#index? ⇒ Boolean
12 13 14 |
# File 'lib/godmin/authorization/policy.rb', line 12 def index? @default end |
#new? ⇒ Boolean
20 21 22 |
# File 'lib/godmin/authorization/policy.rb', line 20 def new? create? end |
#show? ⇒ Boolean
16 17 18 |
# File 'lib/godmin/authorization/policy.rb', line 16 def show? @default end |
#update? ⇒ Boolean
32 33 34 |
# File 'lib/godmin/authorization/policy.rb', line 32 def update? @default end |