Module: Renogen::Formatters
- Defined in:
- lib/renogen/formatters.rb,
lib/renogen/formatters/csv.rb,
lib/renogen/formatters/base.rb,
lib/renogen/formatters/html.rb,
lib/renogen/formatters/markdown.rb,
lib/renogen/formatters/plain_text.rb,
lib/renogen/formatters/markdown_table.rb
Overview
Formatters to manipulate how the change is output
Also has methods to retrive and add a formatters
Defined Under Namespace
Classes: Base, Csv, Html, Markdown, MarkdownTable, PlainText
Class Method Summary collapse
-
.add(identifier, klass) ⇒ Object
Adds a new formatter class to store.
-
.obtain(format_type, options = {}) ⇒ Formatter::Base
Retrieves a formatter from a given key.
Class Method Details
.add(identifier, klass) ⇒ Object
Adds a new formatter class to store
26 27 28 29 |
# File 'lib/renogen/formatters.rb', line 26 def add(identifier, klass) # raise 'name taken' unless formatters[name].nil? formatters[identifier]=klass end |
.obtain(format_type, options = {}) ⇒ Formatter::Base
Retrieves a formatter from a given key
13 14 15 16 17 18 19 20 |
# File 'lib/renogen/formatters.rb', line 13 def obtain(format_type, ={}) formatter = formatters[format_type.to_sym] if formatter formatter.new() else raise Renogen::Exceptions::StratagyNotFound.new(format_type) end end |