Sha256: 2851c2d8268d2938f5ae51d1a9178b15b7e26b03e5842f103a69432e338bd5fd

Contents?: true

Size: 723 Bytes

Versions: 6

Compression:

Stored size: 723 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # 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.
  class NilPresenter < Rectify::Presenter
    def deleted?
      true
    end

    def avatar_url
      Decidim::AvatarUploader.new.default_url
    end

    def respond_to_missing?
      true
    end

    def method_missing(_method, *_args)
      ""
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-core-0.24.3 app/presenters/decidim/nil_presenter.rb
decidim-core-0.24.2 app/presenters/decidim/nil_presenter.rb
decidim-core-0.24.1 app/presenters/decidim/nil_presenter.rb
decidim-core-0.24.0 app/presenters/decidim/nil_presenter.rb
decidim-core-0.24.0.rc2 app/presenters/decidim/nil_presenter.rb
decidim-core-0.24.0.rc1 app/presenters/decidim/nil_presenter.rb