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,
}

Class Method Summary collapse

Class Method Details

.for(format) ⇒ Object


23
24
25
26
27
28
29
# File 'lib/approvals/writer.rb', line 23

def for(format)
  if REGISTRY.include?(format)
    REGISTRY[format]
  else
    TextWriter.new
  end
end