Skip to content

struct Athena::ORM::Types::TypeRegistry
inherits Struct #

Holds an instance of every known AORM::Types::Type, keyed by name.

The registry used by the ORM is available as AORM::Types::Type.type_registry, though types are usually registered through AORM::Types::Type.add_type.

Constructors#

.new(instances : Hash(::String, AORM::Types::Type) = {} of ::String => AORM::Types::Type)#

Creates a registry holding instances, keyed by name.

View source

Methods#

#get(name : ::String) : AORM::Types::Type#

Returns the type registered as name.

Raises if no type is registered with that name.

View source

#has?(name : ::String) : Bool#

Returns true if a type is registered as name.

View source

#instances#

Returns the registered types, keyed by name.

View source

#override(name : ::String, type : AORM::Types::Type) : Nil#

Replaces the type registered as name with type.

Raises if no type is registered with that name.

View source

#register(name : ::String, type : AORM::Types::Type) : Nil#

Registers type as name.

Raises if a type is already registered with that name.

View source