Sha256: f24d7d79a47504290fd391d59a9bd38d4cbe6a8de6e3d94fff34dba623455fbe

Contents?: true

Size: 556 Bytes

Versions: 1

Compression:

Stored size: 556 Bytes

Contents

# frozen_string_literal: true

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

module Srx
  # Format-specific data and logic
  module Format
    FORMATS = {
      text: Text.new,
      xml: Xml.new,
      html: Html.new
    }.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.2.0 lib/srx/format.rb