Class: Handlebars::Helpers::StringFormatting::Humanize

Inherits:
BaseHelper
  • Object
show all
Defined in:
lib/handlebars/helpers/string_formatting/humanize.rb

Overview

humanize wil convert text to human case, aka capitalize

Instance Method Summary collapse

Methods inherited from BaseHelper

#handlebars_helper, #parse_json, #struct_to_hash, #tokenizer, #wrapper

Instance Method Details

#parse(value) ⇒ String

Parse will humanize wil convert text to human case, aka capitalize

Examples:


puts Humanize.new.parse('the quick brown fox 99')

The quick brown fox 99

Returns:

  • (String)

    value converted to sentence case



28
29
30
31
32
33
34
35
# File 'lib/handlebars/helpers/string_formatting/humanize.rb', line 28

def parse(value)
  tokenizer.parse(value,
                  separator: ' ',
                  preserve_case: true,
                  compress_prefix_numerals: false,
                  compress_suffix_numerals: false)
           .humanize
end