Module: Dcc::Extract::Ring

Defined in:
lib/dcc/extract/ring.rb

Overview

The "Ring" of a dcc:byteDataType element: which section of the DCC document contained it. PTB defines these as administrativeData, measurementResults, comment, and document.

Constant Summary collapse

ADMINISTRATIVE_DATA =
:administrativeData
MEASUREMENT_RESULTS =
:measurementResults
COMMENT =
:comment
DOCUMENT =
:document
ALL =
[ADMINISTRATIVE_DATA, MEASUREMENT_RESULTS, COMMENT, DOCUMENT].freeze

Class Method Summary collapse

Class Method Details

.normalize(symbol_or_string) ⇒ Symbol?

Returns the canonical ring symbol.

Parameters:

  • symbol_or_string (Symbol, String, nil)

Returns:

  • (Symbol, nil)

    the canonical ring symbol.



19
20
21
22
23
24
# File 'lib/dcc/extract/ring.rb', line 19

def normalize(symbol_or_string)
  return nil if symbol_or_string.nil?

  sym = symbol_or_string.to_sym
  ALL.include?(sym) ? sym : nil
end