Module: Kramdown::Utils::Configurable

### Home Classes Methods

### In Files

- lib/kramdown/utils/configurable.rb

### Methods

- #configurable

### 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::Configurable

Methods for registering configurable extensions.

### Public Instance Methods

configurable(name) click to toggle source

Create a new configurable extension called `name`.

Three methods will be defined on the calling object which allow to use this configurable extension:

configurables | Returns a hash of hashes that is used to store all configurables of the object.
<name>(ext_name) | Return the configured extension `ext_name`.
add_<name>(ext_name, data=nil, &block) | Define an extension `ext_name` by specifying either the data as argument or by using a block.

    # File lib/kramdown/utils/configurable.rb, line 27
    def configurable(name)
      singleton_class = (class << self; self; end)
      singleton_class.send(:define_method, :configurables) do
        @_configurables ||= Hash.new {|h, k| h[k] = {}}
      end unless respond_to?(:configurables)
      singleton_class.send(:define_method, name) do |data|
        configurables[name][data]
      end
      singleton_class.send(:define_method, "add_#{name}".intern) do |data, *args, &block|
        configurables[name][data] = args.first || block
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.