Module: Approvals::Writer
- Extended by:
- Writers
- Defined in:
- lib/approvals/writer.rb
Constant Summary collapse
- REGISTRY =
{ json: Writers::JsonWriter.new, xml: Writers::XmlWriter.new, html: Writers::HtmlWriter.new, hash: Writers::HashWriter.new, array: Writers::ArrayWriter.new, txt: Writers::TextWriter.new, }
Class Method Summary collapse
Class Method Details
.for(format) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/approvals/writer.rb', line 24 def for(format) begin REGISTRY[format] || Object.const_get(format).new rescue NameError => e error = ApprovalError.new( "Approval Error: #{ e }. Please define a custom writer as outlined"\ " in README section 'Customizing formatted output': "\ "https://github.com/kytrinyx/approvals#customizing-formatted-output" ) raise error end end |