# module Kramdown::Utils

## Utils Module¶ ↑

This module contains utility class/modules/methods that can be used by both parsers and converters.

### Public Class Methods

camelize(name) click to toggle source

Treat `name` as if it were snake cased (e.g. `snake_case`) and camelize it (e.g. SnakeCase).

       # File lib/kramdown/utils.rb
    25 def self.camelize(name)
    26   name.split('_').inject(+'') {|s, x| s << x[0..0].upcase << x[1..-1] }
    27 end

deep_const_get(str) click to toggle source

       # File lib/kramdown/utils.rb
    38 def self.deep_const_get(str)
    39   ::Object.const_get(str)
    40 end

snake_case(name) click to toggle source

Treat `name` as if it were camelized (e.g. CamelizedName) and snake-case it (e.g. camelized_name).

       # File lib/kramdown/utils.rb
    30 def self.snake_case(name)
    31   name = name.dup
    32   name.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
    33   name.gsub!(/([a-z])([A-Z])/, '\1_\2')
    34   name.downcase!
    35   name
    36 end