Class: Admin::SubjectModelAdapter

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/admin/subject_model_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_modelObject

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

Returns:

  • (Boolean)


21
22
23
# File 'app/controllers/admin/subject_model_adapter.rb', line 21

def administrator?
  true
end

#can?(*args) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'app/controllers/admin/subject_model_adapter.rb', line 25

def can?(*args)
  true
end

#can_create?(*args) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'app/controllers/admin/subject_model_adapter.rb', line 33

def can_create?(*args)
  true
end

#can_destroy?(*args) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'app/controllers/admin/subject_model_adapter.rb', line 37

def can_destroy?(*args)
  true
end

#can_edit?(*args) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
# File 'app/controllers/admin/subject_model_adapter.rb', line 29

def can_edit?(*args)
  true
end

#can_new?(*args) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/controllers/admin/subject_model_adapter.rb', line 41

def can_new?(*args)
  true
end

#can_show?(*args) ⇒ Boolean

Returns:

  • (Boolean)


53
54
55
# File 'app/controllers/admin/subject_model_adapter.rb', line 53

def can_show?(*args)
  true
end

#can_sort?(*args) ⇒ Boolean

Returns:

  • (Boolean)


49
50
51
# File 'app/controllers/admin/subject_model_adapter.rb', line 49

def can_sort?(*args)
  true
end

#can_update?(*args) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
# File 'app/controllers/admin/subject_model_adapter.rb', line 45

def can_update?(*args)
  true
end

#guest?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'app/controllers/admin/subject_model_adapter.rb', line 8

def guest?
  !subject_model
end

#logged_in?Boolean

Returns:

  • (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?

Returns:

  • (Boolean)


16
17
18
# File 'app/controllers/admin/subject_model_adapter.rb', line 16

def owner?(object)
  object && ( object.respond_to?(:author) && ( subject_model == object.author ) ) ||  ( object.respond_to?(:owner) && ( subject_model == object.owner ) )
end