class Pandocomatic::Printer
Printer
base class for printing information from pandocomatic
Public Class Methods
new(template_file = 'help.txt')
click to toggle source
Create a new Printer
@param template_file [String = ‘help.txt’] the template to use when
printing.
# File lib/pandocomatic/printer/printer.rb, line 30 def initialize(template_file = 'help.txt') template template_file end
Public Instance Methods
print()
click to toggle source
Print to STDOUT
# File lib/pandocomatic/printer/printer.rb, line 51 def print Pandocomatic::LOG.info self puts self end
template(template_file)
click to toggle source
Set the template used by this Printer
@param template_file [String] the template to use
# File lib/pandocomatic/printer/printer.rb, line 37 def template(template_file) dir = File.dirname(__FILE__) @template = File.absolute_path(File.join(dir, 'views', template_file)) end
to_s()
click to toggle source
Create a string based on this printer’s template
@return [String]
# File lib/pandocomatic/printer/printer.rb, line 45 def to_s erb = ERB.new(File.read(@template), trim_mode: '>') erb.result(binding) end