Class: QuickSearch::BasePresenter
- Inherits:
-
Object
- Object
- QuickSearch::BasePresenter
- Defined in:
- app/presenters/quick_search/base_presenter.rb
Overview
Base presenter for quick search results and pinned records.
Wraps a domain object together with the view context so subclasses can
build display attributes and call URL/helpers without holding a reference
to the controller.
Direct Known Subclasses
Class Method Summary collapse
-
.presents(name) ⇒ Symbol
Defines an instance reader named +name+ that returns the wrapped object.
Instance Method Summary collapse
Constructor Details
#initialize(object, template) ⇒ QuickSearch::BasePresenter
14 15 16 17 |
# File 'app/presenters/quick_search/base_presenter.rb', line 14 def initialize(object, template) @object = object @template = template end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing ⇒ Object (private)
Delegates any unknown method to the view context.
Forwards the method name, arguments, and block (anonymous rest params).
43 44 45 |
# File 'app/presenters/quick_search/base_presenter.rb', line 43 def method_missing(*, &) @template.send(*, &) end |
Class Method Details
.presents(name) ⇒ Symbol
Defines an instance reader named +name+ that returns the wrapped object.
25 26 27 28 29 |
# File 'app/presenters/quick_search/base_presenter.rb', line 25 def self.presents(name) define_method(name) do @object end end |