Module: Decidim::HumanizeBooleansHelper

Defined in:
app/helpers/decidim/humanize_booleans_helper.rb

Overview

Helper to print booleans in a human way.

Instance Method Summary collapse

Instance Method Details

#humanize_boolean(boolean) ⇒ Object

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.



10
11
12
13
# File 'app/helpers/decidim/humanize_booleans_helper.rb', line 10

def humanize_boolean(boolean)
  value = boolean ? "true" : "false"
  I18n.t(value, scope: "booleans")
end