Class: Munificent::Admin::ApplicationPresenter
- Inherits:
-
ActionView::Base
- Object
- ActionView::Base
- Munificent::Admin::ApplicationPresenter
show all
- Defined in:
- app/presenters/munificent/admin/application_presenter.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
rubocop:disable Lint/MissingSuper
20
21
22
|
# File 'app/presenters/munificent/admin/application_presenter.rb', line 20
def initialize(record) @record = record
end
|
Instance Attribute Details
#record ⇒ Object
Returns the value of attribute record.
18
19
20
|
# File 'app/presenters/munificent/admin/application_presenter.rb', line 18
def record
@record
end
|
Class Method Details
.delegate(array, to: :record) ⇒ Object
4
5
6
|
# File 'app/presenters/munificent/admin/application_presenter.rb', line 4
def self.delegate(array, to: :record)
super(*array, to:)
end
|
.present(record) ⇒ Object
8
9
10
|
# File 'app/presenters/munificent/admin/application_presenter.rb', line 8
def self.present(record)
presenter_class_for(record).new(record)
end
|
.presenter_class_for(record) ⇒ Object
12
13
14
15
16
|
# File 'app/presenters/munificent/admin/application_presenter.rb', line 12
def self.presenter_class_for(record)
"#{record.class.name}Presenter".constantize
rescue NameError
raise ArgumentError, "No presenter available for record type `#{record.class.name}`"
end
|
Instance Method Details
#name ⇒ Object
24
25
26
|
# File 'app/presenters/munificent/admin/application_presenter.rb', line 24
def name
record
end
|