Sha256: a6c6a605984c73371a250cd575384107972b76150bf441fc2f489bb87d1cb669

Contents?: true

Size: 607 Bytes

Versions: 64

Compression:

Stored size: 607 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Log
    module ValueTypes
      # This class presents the given value as a percentage. Check
      # the `DefaultPresenter` for more info on how value
      # presenters work.
      class PercentagePresenter < DefaultPresenter
        # Public: Presents the value as a percentage. For clarity,
        # it strips the insignificant zeros.
        #
        # Returns an HTML-safe String.
        def present
          return unless value

          h.number_to_percentage(value, strip_insignificant_zeros: true)
        end
      end
    end
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
decidim-core-0.26.8 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.27.4 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.27.3 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.26.7 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.26.5 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.27.2 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.27.1 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.26.4 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.27.0 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.26.3 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.27.0.rc2 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.27.0.rc1 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.26.2 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.26.1 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.26.0 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.26.0.rc2 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.26.0.rc1 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.25.2 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.25.1 app/presenters/decidim/log/value_types/percentage_presenter.rb
decidim-core-0.25.0 app/presenters/decidim/log/value_types/percentage_presenter.rb