Class: Core::Registry

Inherits:
Object
  • Object
show all
Includes:
Logging, Singleton
Defined in:
app/api/core/registry.rb

Direct Known Subclasses

Io::Registry

Constant Summary collapse

RegistryError =
Class.new(StandardError)
AlreadyRegisteredError =
Class.new(RegistryError)
UnregisteredError =
Class.new(RegistryError)

Instance Method Summary collapse

Methods included from Logging

logging_helper, #low_level

Constructor Details

#initializeRegistry

Returns a new instance of Registry.



11
12
13
# File 'app/api/core/registry.rb', line 11

def initialize
  @model_class_to_target = {}
end

Instance Method Details

#inspectObject



43
44
45
# File 'app/api/core/registry.rb', line 43

def inspect
  @model_class_to_target.to_h { |k, v| [k.to_s, v.to_s] }.inspect
end

#lookup_for_class(model_class) ⇒ Object



35
36
37
# File 'app/api/core/registry.rb', line 35

def lookup_for_class(model_class)
  lookup(model_class)
end

#lookup_for_object(model_instance) ⇒ Object



39
40
41
# File 'app/api/core/registry.rb', line 39

def lookup_for_object(model_instance)
  lookup(model_instance.class)
end