Class: Markup::Rails::Processors::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/markup/rails/processors/base.rb

Overview

To add a new markup processor you have to inherit from this class. In this class you have to add to_* methods for available output formats.

Example:

# lib/markup/rails/processors/obscure_processor.rb
require "markup/rails/processors/base"

module Markup
  module Rails
    module Processors
      class ObscureProcessor < Base
        def to_html
          processor.to_html
        end

        private

        def processor
          Obscure.new(@string)
        end
      end
    end
  end
end

Direct Known Subclasses

Markdown, Pandoc, Textile

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string, options = {}) ⇒ Base

Returns a new instance of Base.



34
35
36
37
# File 'lib/markup/rails/processors/base.rb', line 34

def initialize(string, options = {})
  @string = string
  @options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



32
33
34
# File 'lib/markup/rails/processors/base.rb', line 32

def options
  @options
end

#stringObject

Returns the value of attribute string.



32
33
34
# File 'lib/markup/rails/processors/base.rb', line 32

def string
  @string
end