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, , filename) klass = get([:format]) if klass.nil? puts Rainbow("[ERROR] Unkown format: #{[:format]}").red puts Rainbow(" export format: FORMAT").red exit 1 end formatter = klass.new(report) formatter.init(filename) report.format = formatter.ext formatter.process() 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 |