class GstKitchen::Feed

Constants

TEMPLATE_PATH

Attributes

format[R]
template[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/gst-kitchen/feed.rb, line 54
def initialize(options = {})
  @format   = options[:format]
  @template = ERB.new(File.read(File.join(TEMPLATE_PATH, "#{options[:template]}.rss.erb")))
end

Public Instance Methods

render_as_markdown(text) click to toggle source
# File lib/gst-kitchen/feed.rb, line 59
def render_as_markdown(text)
  markdown = Redcarpet::Markdown.new(ShownotesRenderer, autolink: true)
  markdown.render text
end
to_xml(variables = {}) click to toggle source
# File lib/gst-kitchen/feed.rb, line 64
def to_xml(variables = {})
  variables.each { |var, value| instance_variable_set("@#{var}", value) }

  @template.result(binding)
end