Module: Kramdown::Utils

### Home Classes Methods

### In Files

- lib/kramdown/utils.rb
- lib/kramdown/utils/configurable.rb
- lib/kramdown/utils/entities.rb
- lib/kramdown/utils/html.rb
- lib/kramdown/utils/ordered_hash.rb
- lib/kramdown/utils/string_scanner.rb
- lib/kramdown/utils/unidecoder.rb

### Namespace

- MODULE Kramdown::Utils::Configurable
- MODULE Kramdown::Utils::Entities
- MODULE Kramdown::Utils::Html
- MODULE Kramdown::Utils::Unidecoder
- CLASS Kramdown::Utils::OrderedHash
- CLASS Kramdown::Utils::StringScanner

### Methods

- ::camelize
- ::deep_const_get
- ::snake_case

### Class/Module Index

Quicksearch

- Kramdown
- Kramdown::Converter
- Kramdown::Converter::Base
- Kramdown::Converter::Html
- Kramdown::Converter::Kramdown
- Kramdown::Converter::Latex
- Kramdown::Converter::MathEngine
- Kramdown::Converter::MathEngine::Itex2MML
- Kramdown::Converter::MathEngine::Mathjax
- Kramdown::Converter::MathEngine::MathjaxNode
- Kramdown::Converter::MathEngine::Ritex
- Kramdown::Converter::RemoveHtmlTags
- Kramdown::Converter::SyntaxHighlighter
- Kramdown::Converter::SyntaxHighlighter::Coderay
- Kramdown::Converter::SyntaxHighlighter::Minted
- Kramdown::Converter::SyntaxHighlighter::Rouge
- Kramdown::Converter::Toc
- Kramdown::Document
- Kramdown::Element
- Kramdown::Error
- Kramdown::Options
- Kramdown::Options::Boolean
- Kramdown::Parser
- Kramdown::Parser::Base
- Kramdown::Parser::GFM
- Kramdown::Parser::Html
- Kramdown::Parser::Html::Constants
- Kramdown::Parser::Html::ElementConverter
- Kramdown::Parser::Html::Parser
- Kramdown::Parser::Kramdown
- Kramdown::Parser::Markdown
- Kramdown::Utils
- Kramdown::Utils::Configurable
- Kramdown::Utils::Entities
- Kramdown::Utils::Entities::Entity
- Kramdown::Utils::Html
- Kramdown::Utils::OrderedHash
- Kramdown::Utils::StringScanner
- Kramdown::Utils::Unidecoder

No matching classes.

# Kramdown::Utils

## Utils Module

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

### Constants

OrderedHash

### 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, line 25
    def self.camelize(name)
      name.split('_').inject('') {|s,x| s << x[0..0].upcase << x[1..-1] }
    end

deep_const_get(str) click to toggle source

Resolve the recursive constant `str`.

    # File lib/kramdown/utils.rb, line 41
    def self.deep_const_get(str)
      names = str.split(/::/)
      names.shift if names.first.empty?
      names.inject(::Object) {|mod, s| mod.const_get(s)}
    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, 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.