Module: CapturefulFormatter::Printer

Defined in:
lib/captureful_formatter/printer.rb

Defined Under Namespace

Classes: Template, TemplateMissingError

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.titleObject

Returns the value of attribute title.



24
25
26
# File 'lib/captureful_formatter/printer.rb', line 24

def title
  @title
end

Class Method Details



26
27
28
29
30
31
32
33
34
35
# File 'lib/captureful_formatter/printer.rb', line 26

def print(features)
  path = template_path
  params = {
    title: CapturefulFormatter.configuration.project_name,
    features: features
  }
  template = Template.new(params)
  filename = File.join(CapturefulFormatter.configuration.output_directory, "/index.html")
  File.write(filename ,template.render(File.read(path)))
end

.template_pathObject



37
38
39
40
41
42
43
# File 'lib/captureful_formatter/printer.rb', line 37

def template_path
  path = CapturefulFormatter.configuration.template_path
  path = File.absolute_path(path)
  raise TemplateMissingError, path unless File.exists? path

  path
end