Sha256: b312322285ff662c68388edb1023e749d8fec9aef914013e9e5815baa7d7bac8

Contents?: true

Size: 552 Bytes

Versions: 1

Compression:

Stored size: 552 Bytes

Contents

# frozen_string_literal: true

require_relative 'format/base_format'
require_relative 'format/text'
require_relative 'format/xml'

module Srx
  # Format-specific data and logic
  module Format
    FORMATS = {
      text: Text.new,
      xml: Xml.new,
      html: Xml.new # TODO: specialize for HTML
    }.freeze

    class << self
      # @param format [Symbol]
      # @return [BaseFormat]
      def get(format)
        raise(ArgumentError, "Unknown format: #{format}") unless FORMATS.key?(format)

        FORMATS[format]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
srx-0.1.0 lib/srx/format.rb