Class: TypedData::KeyFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/typed_data/key_formatter.rb

Defined Under Namespace

Classes: UnknownFormatter

Constant Summary collapse

UNION_TYPE_KEY_FORMATTERS =
{
  bigquery: ->(type) { "#{type}_value" },
  avro: ->(type) { type.split("_").first },
}

Class Method Summary collapse

Class Method Details

.find(formatter) ⇒ Object

Parameters:

  • formatter (Symbol)


11
12
13
14
15
# File 'lib/typed_data/key_formatter.rb', line 11

def self.find(formatter)
  UNION_TYPE_KEY_FORMATTERS.fetch(formatter) do
    raise UnknownFormatter, "Unknown formatter: #{formatter}"
  end
end