class Handlebars::Helpers::CodeRuby::Tableize

Tableize: Creates the name of a table like Rails does when converting models to table names

Public Instance Methods

handlebars_helper() click to toggle source
# File lib/handlebars/helpers/code_ruby/tableize.rb, line 29
def handlebars_helper
  proc { |_context, value| wrapper(parse(value)) }
end
parse(value) click to toggle source

Parse will creates the name of a table like Rails does when converting models to table names

@example

puts Tableize.new.parse('product category')

product_categories

@param [String] value - name of the table @return [String] value converted to table case with pluralization

# File lib/handlebars/helpers/code_ruby/tableize.rb, line 24
def parse(value)
  # tokenizer.parse(value, separator: '_', forced_separator: true).classify
  tokenizer.parse(value).tableize
end