module Mailbot::Renderer

Constants

BLOCK_SYMBOL

Public Class Methods

block() click to toggle source
# File lib/mailbot/renderer.rb, line 23
def block
  Thread.current[BLOCK_SYMBOL] || default
end
default() click to toggle source
# File lib/mailbot/renderer.rb, line 27
def default
  ->(text) do
    renderer = HTMLwithCodeRay.new :filter_html => true, :hard_wrap => true
    markdown = Redcarpet::Markdown.new renderer, :autolink => true, :space_after_headers => true, :fenced_code_blocks => true
    markdown.render text
  end
end
render(text) click to toggle source
# File lib/mailbot/renderer.rb, line 15
def render(text)
  block.call text
end
set(&block) click to toggle source
# File lib/mailbot/renderer.rb, line 19
def set(&block)
  Thread.current[BLOCK_SYMBOL] = block
end