Class: Peatio::AdapterRegistry
- Inherits:
-
Object
- Object
- Peatio::AdapterRegistry
show all
- Defined in:
- lib/peatio/adapter_registry.rb
Constant Summary
collapse
- Error =
Class.new(StandardError)
- DuplicatedAdapterError =
Class.new(Error)
- NotRegisteredAdapterError =
Class.new(Error)
Instance Method Summary
collapse
Instance Method Details
#[](name) ⇒ Object
13
14
15
|
# File 'lib/peatio/adapter_registry.rb', line 13
def [](name)
adapters.fetch(name.to_sym) { raise NotRegisteredAdapterError, name }
end
|
#[]=(name, instance) ⇒ Object
7
8
9
10
11
|
# File 'lib/peatio/adapter_registry.rb', line 7
def []=(name, instance)
name = name.to_sym
raise DuplicatedAdapterError, name if adapters.key?(name)
adapters[name] = instance
end
|
#adapters ⇒ Object
17
18
19
|
# File 'lib/peatio/adapter_registry.rb', line 17
def adapters
@adapters ||= {}
end
|
#adapters=(h) ⇒ Object
21
22
23
|
# File 'lib/peatio/adapter_registry.rb', line 21
def adapters=(h)
@adapters = h
end
|