Class: Decidim::NilPresenter
- Inherits:
-
Object
- Object
- Decidim::NilPresenter
- Defined in:
- app/presenters/decidim/nil_presenter.rb
Overview
A default presenter for the cases when the presented object is nil. For example, when there are data inconsistencies like when a Meeting which is the creator of a proposal is removed. This presenter will also be useful if the presenter for the presented object can not be resolved.
It behaves as a presenter for deleted resources. Returns an empty string for most of the method calls.
Instance Method Summary collapse
- #avatar_url(_variant = nil) ⇒ Object
- #deleted? ⇒ Boolean
-
#initialize ⇒ NilPresenter
constructor
A new instance of NilPresenter.
- #method_missing(_method, *_args) ⇒ Object
- #respond_to_missing? ⇒ Boolean
Constructor Details
#initialize ⇒ NilPresenter
Returns a new instance of NilPresenter.
11 |
# File 'app/presenters/decidim/nil_presenter.rb', line 11 def initialize(*); end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(_method, *_args) ⇒ Object
25 26 27 |
# File 'app/presenters/decidim/nil_presenter.rb', line 25 def method_missing(_method, *_args) "" end |
Instance Method Details
#avatar_url(_variant = nil) ⇒ Object
17 18 19 |
# File 'app/presenters/decidim/nil_presenter.rb', line 17 def avatar_url(_variant = nil) Decidim::AvatarUploader.new(Decidim::User.new, :avatar).default_url end |
#deleted? ⇒ Boolean
13 14 15 |
# File 'app/presenters/decidim/nil_presenter.rb', line 13 def deleted? true end |
#respond_to_missing? ⇒ Boolean
21 22 23 |
# File 'app/presenters/decidim/nil_presenter.rb', line 21 def respond_to_missing?(*) true end |