Module: Gitlab::View::Presenter::Base
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Routing
add_helpers, includes_helpers, redirect_legacy_paths, url_helpers
Instance Attribute Details
#subject ⇒ Object
Returns the value of attribute subject
14
15
16
|
# File 'lib/gitlab/view/presenter/base.rb', line 14
def subject
@subject
end
|
Instance Method Details
#can?(user, action, overridden_subject = nil) ⇒ Boolean
16
17
18
|
# File 'lib/gitlab/view/presenter/base.rb', line 16
def can?(user, action, overridden_subject = nil)
super(user, action, overridden_subject || subject)
end
|
#declarative_policy_delegate ⇒ Object
delegate all #can? queries to the subject
21
22
23
|
# File 'lib/gitlab/view/presenter/base.rb', line 21
def declarative_policy_delegate
subject
end
|
#is_a?(type) ⇒ Boolean
33
34
35
|
# File 'lib/gitlab/view/presenter/base.rb', line 33
def is_a?(type)
super || subject.is_a?(type)
end
|
#present(**attributes) ⇒ Object
25
26
27
|
# File 'lib/gitlab/view/presenter/base.rb', line 25
def present(**attributes)
self
end
|
#url_builder ⇒ Object
29
30
31
|
# File 'lib/gitlab/view/presenter/base.rb', line 29
def url_builder
Gitlab::UrlBuilder.instance
end
|
#web_path ⇒ Object
41
42
43
|
# File 'lib/gitlab/view/presenter/base.rb', line 41
def web_path
url_builder.build(subject, only_path: true)
end
|
#web_url ⇒ Object
37
38
39
|
# File 'lib/gitlab/view/presenter/base.rb', line 37
def web_url
url_builder.build(subject)
end
|