### Home Classes Methods

### In Files

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

### Namespace

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

### Methods

- ::camelize
- ::snake_case

### Class/Module Index

Quicksearch

- Kramdown
- Kramdown::Converter
- Kramdown::Converter::Base
- Kramdown::Converter::Html
- Kramdown::Converter::Kramdown
- Kramdown::Converter::Latex
- Kramdown::Converter::RemoveHtmlTags
- 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::Entities
- Kramdown::Utils::Entities::Entity
- Kramdown::Utils::Html
- Kramdown::Utils::OrderedHash
- 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 23
    def self.camelize(name)
      name.split('_').inject('') {|s,x| s << x[0..0].upcase + x[1..-1] }
    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 28
    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.