Class: Handlebars::Helpers::StringFormatting::Constantize

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

Overview

CONSTANT case the characters in the given ‘string’.

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 CONSTANT case the characters in the given ‘string’.

Examples:


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

THE_QUICK_BROWN_FOX99

Returns:

  • (String)

    value converted to constant case



23
24
25
# File 'lib/handlebars/helpers/string_formatting/constantize.rb', line 23

def parse(value)
  tokenizer.parse(value, separator: '_').upcase
end