Class: Handlebars::Helpers::StringFormatting::Snake

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

Overview

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

Examples:


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

the_quick_brown_fox99

Returns:

  • (String)

    value converted to snake case



27
28
29
# File 'lib/handlebars/helpers/string_formatting/snake.rb', line 27

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