Module: Formatter

Defined in:
lib/teuton/report/formatter/formatter.rb

Class Method Summary collapse

Class Method Details

.call(report, options, filename) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/teuton/report/formatter/formatter.rb', line 16

def self.call(report, options, filename)
  klass = get(options[:format])
  if klass.nil?
    puts Rainbow("[ERROR] Unkown format: #{options[:format]}").red
    puts Rainbow("        export format: FORMAT").red
    exit 1
  end
  formatter = klass.new(report)
  formatter.init(filename)
  report.format = formatter.ext
  formatter.process(options)
end

.get(format) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/teuton/report/formatter/formatter.rb', line 29

def self.get(format)
  list = {
    colored_text: ColoredTextFormatter,
    html: HTMLFormatter,
    json: JSONFormatter,
    txt: TXTFormatter,
    xml: XMLFormatter,
    yaml: YAMLFormatter,
    moodle_csv: MoodleCSVFormatter,
    resume_html: ResumeHTMLFormatter,
    resume_json: ResumeJSONFormatter,
    resume_txt: ResumeTXTFormatter,
    resume_xml: ResumeTXTFormatter, # TODO
    resume_yaml: ResumeYAMLFormatter
  }
  list[format]
end

.hide_feedback(report) ⇒ Object



47
48
49
50
51
52
53
54
# File 'lib/teuton/report/formatter/formatter.rb', line 47

def self.hide_feedback(report)
  report2 = report.clone
  report2.groups.each do |group|
    group.each do |item|
      puts item
    end
  end
end