Sha256: beaf8b3edcbd31c16266f9d11b7dbad9a8feb47b30503ad9dc59d99fcd599bc1
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
Contents
require 'approvals/writers/text_writer' require 'approvals/writers/array_writer' require 'approvals/writers/hash_writer' require 'approvals/writers/html_writer' require 'approvals/writers/xml_writer' require 'approvals/writers/json_writer' require 'approvals/writers/binary_writer' module Approvals module Writer extend Writers 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 << self 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 end end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
approvals-0.0.26 | lib/approvals/writer.rb |
approvals-0.0.25 | lib/approvals/writer.rb |
approvals-0.0.24 | lib/approvals/writer.rb |
br-approvals-0.0.22 | lib/approvals/writer.rb |