Class: Admin::SubjectModelAdapter
- Inherits:
-
Object
- Object
- Admin::SubjectModelAdapter
- Defined in:
- app/controllers/admin/subject_model_adapter.rb
Instance Attribute Summary collapse
-
#subject_model ⇒ Object
Returns the value of attribute subject_model.
Instance Method Summary collapse
- #administrator? ⇒ Boolean
- #can?(*args) ⇒ Boolean
- #can_create?(*args) ⇒ Boolean
- #can_destroy?(*args) ⇒ Boolean
- #can_edit?(*args) ⇒ Boolean
- #can_new?(*args) ⇒ Boolean
- #can_show?(*args) ⇒ Boolean
- #can_sort?(*args) ⇒ Boolean
- #can_update?(*args) ⇒ Boolean
- #guest? ⇒ Boolean
-
#initialize(subject_model) ⇒ SubjectModelAdapter
constructor
A new instance of SubjectModelAdapter.
- #logged_in? ⇒ Boolean
- #owner?(object) ⇒ Boolean (also: #own?)
Constructor Details
#initialize(subject_model) ⇒ SubjectModelAdapter
Returns a new instance of SubjectModelAdapter.
4 5 6 |
# File 'app/controllers/admin/subject_model_adapter.rb', line 4 def initialize(subject_model) @subject_model = subject_model end |
Instance Attribute Details
#subject_model ⇒ Object
Returns the value of attribute subject_model.
2 3 4 |
# File 'app/controllers/admin/subject_model_adapter.rb', line 2 def subject_model @subject_model end |
Instance Method Details
#administrator? ⇒ Boolean
21 22 23 |
# File 'app/controllers/admin/subject_model_adapter.rb', line 21 def administrator? true end |
#can?(*args) ⇒ Boolean
25 26 27 |
# File 'app/controllers/admin/subject_model_adapter.rb', line 25 def can?(*args) true end |
#can_create?(*args) ⇒ Boolean
33 34 35 |
# File 'app/controllers/admin/subject_model_adapter.rb', line 33 def can_create?(*args) true end |
#can_destroy?(*args) ⇒ Boolean
37 38 39 |
# File 'app/controllers/admin/subject_model_adapter.rb', line 37 def can_destroy?(*args) true end |
#can_edit?(*args) ⇒ Boolean
29 30 31 |
# File 'app/controllers/admin/subject_model_adapter.rb', line 29 def can_edit?(*args) true end |
#can_new?(*args) ⇒ Boolean
41 42 43 |
# File 'app/controllers/admin/subject_model_adapter.rb', line 41 def can_new?(*args) true end |
#can_show?(*args) ⇒ Boolean
53 54 55 |
# File 'app/controllers/admin/subject_model_adapter.rb', line 53 def can_show?(*args) true end |
#can_sort?(*args) ⇒ Boolean
49 50 51 |
# File 'app/controllers/admin/subject_model_adapter.rb', line 49 def can_sort?(*args) true end |
#can_update?(*args) ⇒ Boolean
45 46 47 |
# File 'app/controllers/admin/subject_model_adapter.rb', line 45 def can_update?(*args) true end |
#guest? ⇒ Boolean
8 9 10 |
# File 'app/controllers/admin/subject_model_adapter.rb', line 8 def guest? !subject_model end |
#logged_in? ⇒ Boolean
12 13 14 |
# File 'app/controllers/admin/subject_model_adapter.rb', line 12 def logged_in? !!subject_model end |
#owner?(object) ⇒ Boolean Also known as: own?
16 17 18 |
# File 'app/controllers/admin/subject_model_adapter.rb', line 16 def owner?(object) object && ( object.respond_to?(:author) && ( subject_model == object. ) ) || ( object.respond_to?(:owner) && ( subject_model == object.owner ) ) end |