Class: Mooncell::Protocol::Registry Private

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Singleton
Defined in:
lib/mooncell/protocol/registry.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

Instance Method Summary collapse

Constructor Details

#initializeRegistry

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Registry.

Since:

  • 0.1.0



19
20
21
# File 'lib/mooncell/protocol/registry.rb', line 19

def initialize
  @protocols = Concurrent::Map.new
end

Instance Method Details

#lookup(name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



28
29
30
# File 'lib/mooncell/protocol/registry.rb', line 28

def lookup(name)
  @protocols[name]
end

#register(klass) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



23
24
25
26
# File 'lib/mooncell/protocol/registry.rb', line 23

def register(klass)
  name = klass.name.split('::').last.downcase
  @protocols[name] = klass
end