Class: Handlebars::Helpers::StringFormatting::Titleize

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

Overview

titleize case the characters in the given ‘string’, aka heading case

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 titleize case the characters in the given ‘string’, aka heading case

Examples:


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

The Quick Brown Fox 99

Returns:

  • (String)

    value converted to titleize case



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

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