module Kramdown::Utils
Utils Module¶ ↑
This module contains utility class/modules/methods that can be used by both parsers and converters.
Public Class Methods
Source
# File lib/kramdown/utils.rb, line 25 def self.camelize(name) name.split('_').inject(+'') {|s, x| s << x[0..0].upcase << x[1..-1] } end
Treat name
as if it were snake cased (e.g. snake_case
) and camelize it (e.g. SnakeCase).
Source
# File lib/kramdown/utils.rb, line 38 def self.deep_const_get(str) ::Object.const_get(str) end
Source
# File lib/kramdown/utils.rb, line 30 def self.snake_case(name) name = name.dup name.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2') name.gsub!(/([a-z])([A-Z])/, '\1_\2') name.downcase! name end
Treat name
as if it were camelized (e.g. CamelizedName) and snake-case it (e.g. camelized_name).