Sha256: 65c347b97a5027a2a57487b79aa9489b98caefedadaa17b9a722dec9d23c5308

Contents?: true

Size: 498 Bytes

Versions: 8

Compression:

Stored size: 498 Bytes

Contents

require_relative 'formats/base'
require_relative 'formats/human'

module Mulder
  class Formatter

    VALID_FORMATS = {
      'human' => Formats::Human
    }

    def initialize(instances, format)
      unless VALID_FORMATS.keys.include?(format)
        raise NotImplementedError.new("Formatting as #{format} has not been implemented!")
      end

      @instances = instances
      @format    = VALID_FORMATS[format]
    end

    def output
      @format.new(@instances).output
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mulder-0.3.1 lib/mulder/formatter.rb
mulder-0.3.0 lib/mulder/formatter.rb
mulder-0.2.1 lib/mulder/formatter.rb
mulder-0.2.0 lib/mulder/formatter.rb
mulder-0.1.0 lib/mulder/formatter.rb
mulder-0.0.5 lib/mulder/formatter.rb
mulder-0.0.4 lib/mulder/formatter.rb
mulder-0.0.3 lib/mulder/formatter.rb