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


9
10
11
# File 'app/api/core/registry.rb', line 9

def initialize
  @model_class_to_target = {}
end

Instance Method Details

#inspectObject


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

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

#lookup_for_class(model_class) ⇒ Object


30
31
32
# File 'app/api/core/registry.rb', line 30

def lookup_for_class(model_class)
  lookup(model_class)
end

#lookup_for_object(model_instance) ⇒ Object


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

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