Module: Formatter
- Defined in:
- lib/teuton/report/formatter/formatter.rb
Constant Summary collapse
- LIST =
{ colored_text: ColoredTextFormatter, html: HTMLFormatter, json: JSONFormatter, markdown: MarkdownFormatter, txt: TXTFormatter, xml: XMLFormatter, yaml: YAMLFormatter, moodle_csv: MoodleCSVFormatter, resume_colored_text: ResumeColoredTextFormatter, resume_html: ResumeHTMLFormatter, resume_json: ResumeJSONFormatter, resume_markdown: ResumeMarkdownFormatter, resume_txt: ResumeTXTFormatter, resume_xml: ResumeTXTFormatter, # TODO resume_yaml: ResumeYAMLFormatter }
Class Method Summary collapse
Class Method Details
.available_formats ⇒ Object
36 37 38 |
# File 'lib/teuton/report/formatter/formatter.rb', line 36 def self.available_formats LIST.keys.take(7) end |
.call(report, options, filename) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/teuton/report/formatter/formatter.rb', line 40 def self.call(report, , filename) klass = get([:format]) if klass.nil? puts "[ERROR] Formatter:" puts " Unkown format <#{[:format]}>. Fix line <export format: FORMAT>" puts " Available formats: #{Formatter.available_formats.join(",")}." exit 1 end formatter = klass.new(report) formatter.init(filename) report.format = formatter.ext formatter.process() end |
.get(format) ⇒ Object
54 55 56 |
# File 'lib/teuton/report/formatter/formatter.rb', line 54 def self.get(format) LIST[format] end |