Module: Srx::Format

Defined in:
lib/srx/format.rb,
lib/srx/format/xml.rb,
lib/srx/format/html.rb,
lib/srx/format/text.rb,
lib/srx/format/base_format.rb

Overview

Format-specific data and logic

Defined Under Namespace

Classes: BaseFormat, Html, Text, Xml

Constant Summary collapse

FORMATS =
{
  text: Text.new,
  xml: Xml.new,
  html: Html.new
}.freeze

Class Method Summary collapse

Class Method Details

.get(format) ⇒ BaseFormat

Parameters:

  • format (Symbol)

    see keys of FORMATS for accepted values

Returns:

Raises:

  • (ArgumentError)


20
21
22
23
24
# File 'lib/srx/format.rb', line 20

def get(format)
  raise(ArgumentError, "Unknown format: #{format}") unless FORMATS.key?(format)

  FORMATS[format]
end