Sha256: 6ef5930c9cd9ee9e7b64dd7c92b9c26f08b4b76ce5565171ccfd5d6edde5ce0b

Contents?: true

Size: 771 Bytes

Versions: 4

Compression:

Stored size: 771 Bytes

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.instance,
      xml: Writers::XmlWriter.instance,
      html: Writers::HtmlWriter.instance,
      hash: Writers::HashWriter.instance,
      array: Writers::ArrayWriter.instance,
    }
        

    class << self
      def for(format)
        if REGISTRY.include?(format)
          REGISTRY[format]
        else
          TextWriter.instance
        end
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
approvals-0.0.12 lib/approvals/writer.rb
approvals-0.0.11 lib/approvals/writer.rb
approvals-0.0.10 lib/approvals/writer.rb
approvals-0.0.9 lib/approvals/writer.rb