class RTFDoc::AttributesComponent

Public Class Methods

new(raw_attrs, title) click to toggle source
# File lib/rtfdoc.rb, line 20
def initialize(raw_attrs, title)
  @attributes = YAML.load(raw_attrs)
  @title      = title
end
private_renderer() click to toggle source

Needed because we can't call the same rendered within itself.

# File lib/rtfdoc.rb, line 11
def self.private_renderer
  @renderer ||= Redcarpet::Markdown.new(::RTFDoc::Renderer, {
    underline:            true,
    space_after_headers:  true,
    fenced_code_blocks:   true,
    no_intra_emphasis:    true
  })
end

Public Instance Methods

to_html(text) click to toggle source
# File lib/rtfdoc.rb, line 30
def to_html(text)
  self.class.private_renderer.render(text) if text
end