Class: Pubid::Iso::FormatResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/pubid/iso/format_resolver.rb

Overview

Resolves format symbols to rendering options

Constant Summary collapse

FORMATS =
{
  ref_num_short: {
    with_language_code: :single,      # 1-char: E, F, R, A, S, D
    stage_format_long: false,         # Short: DAM, COR, FDAM
    with_date: true,
  },
  ref_num_long: {
    with_language_code: :iso,         # 2-char: en, fr, ru, ar, es, de
    stage_format_long: true,          # Long: DAmd, Cor, FDAmd
    with_date: true,
  },
  ref_dated: {
    with_language_code: :none,
    stage_format_long: false,
    with_date: true,
  },
  ref_dated_long: {
    with_language_code: :none,
    stage_format_long: true,
    with_date: true,
  },
  ref_undated: {
    with_language_code: :none,
    stage_format_long: false,
    with_date: false,
  },
  ref_undated_long: {
    with_language_code: :none,
    stage_format_long: true,
    with_date: false,
  },
}.freeze

Class Method Summary collapse

Class Method Details

.resolve(format) ⇒ Object



40
41
42
# File 'lib/pubid/iso/format_resolver.rb', line 40

def self.resolve(format)
  FORMATS[format] || raise(ArgumentError, "Unknown format: #{format}")
end