Sha256: 0021e46a50769fb769a573ec33819134537a98abf09e3e9d8355d52c93989624

Contents?: true

Size: 597 Bytes

Versions: 1

Compression:

Stored size: 597 Bytes

Contents

require_relative 'converter/element'
require_relative 'converter/collection'
require_relative 'converter/boolean'
require_relative 'converter/datetime'
require_relative 'converter/errors'
require_relative 'converter/unknown'

module Typekit
  module Converter
    MAPPING = {
      :element => Element,
      :collection => Collection,

      'ok' => Boolean,
      'errors' => Errors,
      'published' => DateTime,

      nil => Errors
    }
    MAPPING.default = Unknown

    def self.build(name, *arguments)
      MAPPING[Record.identify(name) || name].new(name, *arguments)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
typekit-client-0.0.6 lib/typekit/converter.rb