Sha256: 4fcd3720229c14f1d7377bdaa089777479e8f53df38c8fbab86a476a3c84f7c0

Contents?: true

Size: 777 Bytes

Versions: 12

Compression:

Stored size: 777 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
    def initialize(*); end

    def deleted?
      true
    end

    def avatar_url(_variant = nil)
      Decidim::AvatarUploader.new(Decidim::User.new, :avatar).default_url
    end

    def respond_to_missing?(*)
      true
    end

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
decidim-core-0.27.9 app/presenters/decidim/nil_presenter.rb
decidim-core-0.27.8 app/presenters/decidim/nil_presenter.rb
decidim-core-0.27.7 app/presenters/decidim/nil_presenter.rb
decidim-core-0.27.6 app/presenters/decidim/nil_presenter.rb
decidim-core-0.27.5 app/presenters/decidim/nil_presenter.rb
decidim-core-0.27.4 app/presenters/decidim/nil_presenter.rb
decidim-core-0.27.3 app/presenters/decidim/nil_presenter.rb
decidim-core-0.27.2 app/presenters/decidim/nil_presenter.rb
decidim-core-0.27.1 app/presenters/decidim/nil_presenter.rb
decidim-core-0.27.0 app/presenters/decidim/nil_presenter.rb
decidim-core-0.27.0.rc2 app/presenters/decidim/nil_presenter.rb
decidim-core-0.27.0.rc1 app/presenters/decidim/nil_presenter.rb