class Sendmark::Render
Public Class Methods
new(extentions)
click to toggle source
Calls superclass method
# File lib/sendmark/render.rb, line 3 def initialize(extentions) @css_parser = extentions[:css_parser] unless extentions[:css_parser].nil? super end
Public Instance Methods
header(text, header_level)
click to toggle source
# File lib/sendmark/render.rb, line 8 def header(text, header_level) tag = "h#{header_level}" if css_defined_with?(tag) "<#{tag} style=\"#{css_style(tag)}\">#{text}</#{tag}>" else "<#{tag}>#{text}</#{tag}>" end end
link(link, title, content)
click to toggle source
# File lib/sendmark/render.rb, line 33 def link(link, title, content) if css_defined_with?("a") "<a style=\"#{css_style("a")}\" href=\"#{link}\">#{content}</a>" else "<a href=\"#{link}\">#{content}</a>" end end
list_item(text, list_type)
click to toggle source
# File lib/sendmark/render.rb, line 17 def list_item(text, list_type) if css_defined_with?("li") "<li style=\"#{css_style("li")}\">#{text}</li>" else "<li>#{text}</li>" end end
paragraph(text)
click to toggle source
# File lib/sendmark/render.rb, line 25 def paragraph(text) if css_defined_with?("p") "<p style=\"#{css_style("p")}\">#{text}</p>" else "<p>#{text}</p>" end end
Private Instance Methods
css_defined_with?(selector)
click to toggle source
# File lib/sendmark/render.rb, line 46 def css_defined_with?(selector) return false if @css_parser.nil? || @css_parser.send(selector).nil? true end
css_style(selector)
click to toggle source
# File lib/sendmark/render.rb, line 42 def css_style(selector) @css_parser.send(selector) end