Sha256: 684f6c602549d8e980447f828bd1ae257a85757eec03406721fc7177080f5427

Contents?: true

Size: 431 Bytes

Versions: 10

Compression:

Stored size: 431 Bytes

Contents

# frozen_string_literal: true
module Decidim
  # Helper to print booleans in a human way.
  module HumanizeBooleansHelper
    # Displays booleans in a human way (yes/no, supporting i18n). Supports
    # `nil` values as `false`.
    #
    # boolean - a Boolean that will be displayed in a human way.
    def humanize_boolean(boolean)
      value = boolean ? "true" : "false"
      I18n.t(value, scope: "booleans")
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
decidim-core-0.1.0 app/helpers/decidim/humanize_booleans_helper.rb
decidim-core-0.0.8.1 app/helpers/decidim/humanize_booleans_helper.rb
decidim-core-0.0.7 app/helpers/decidim/humanize_booleans_helper.rb
decidim-core-0.0.6 app/helpers/decidim/humanize_booleans_helper.rb
decidim-core-0.0.5 app/helpers/decidim/humanize_booleans_helper.rb
decidim-core-0.0.3 app/helpers/decidim/humanize_booleans_helper.rb
decidim-core-0.0.2 app/helpers/decidim/humanize_booleans_helper.rb
decidim-core-0.0.1 app/helpers/decidim/humanize_booleans_helper.rb
decidim-core-0.0.1.alpha9 app/helpers/decidim/humanize_booleans_helper.rb
decidim-core-0.0.1.alpha8 app/helpers/decidim/humanize_booleans_helper.rb