class Msgtrail::PartialRenderer

Attributes

config[RW]
markdown[RW]
partial[RW]
plaintext[RW]
variables[RW]

Public Class Methods

new(partial_filepath, variables, config) click to toggle source
# File lib/msgtrail/renderers.rb, line 95
def initialize(partial_filepath, variables, config)
  begin
    self.partial = File.read(partial_filepath)
  rescue
    puts("Can't find '#{partial_filepath}' (#{$!})")
    exit(2)
  end
  self.config = config
  self.markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, fenced_code_blocks: true, strikethrough: true)
  self.plaintext = Redcarpet::Markdown.new(Redcarpet::Render::StripDown)
  self.variables = variables
end

Public Instance Methods

method_missing(missing_method_name, *args, &block) click to toggle source
Calls superclass method
# File lib/msgtrail/renderers.rb, line 108
def method_missing(missing_method_name, *args, &block)
  if 'cfg' == missing_method_name.to_s
    self.config.settings
  else
    super
  end
end
render() click to toggle source
# File lib/msgtrail/renderers.rb, line 116
def render
  ERB.new(self.partial).result(binding)
end