Module: WnmSupport::ViewHelpers::BoolToHuman

Defined in:
lib/wnm_support/view_helpers/bool_to_human.rb

Instance Method Summary collapse

Instance Method Details

#bool_to_human(value) ⇒ Object



4
5
6
# File 'lib/wnm_support/view_helpers/bool_to_human.rb', line 4

def bool_to_human(value)
  I18n.t(value == true ? "yes" : "no")
end

#bool_to_human_with_empty(value) ⇒ Object



8
9
10
11
12
# File 'lib/wnm_support/view_helpers/bool_to_human.rb', line 8

def bool_to_human_with_empty(value)
  return "" if value.nil?

  bool_to_human(value)
end