Class: Openphar::Registry::PublisherRegistry
- Inherits:
-
Object
- Object
- Openphar::Registry::PublisherRegistry
- Defined in:
- lib/openphar/registry/publisher_registry.rb
Overview
Registry for pharmacopoeia publishers.
Class Method Summary collapse
- .all_codes ⇒ Object
- .clear ⇒ Object
- .get(code) ⇒ Object
- .namespace_for(code) ⇒ Object
- .register(code, info) ⇒ Object
- .registered?(code) ⇒ Boolean
Class Method Details
.all_codes ⇒ Object
21 22 23 |
# File 'lib/openphar/registry/publisher_registry.rb', line 21 def all_codes registry.keys end |
.clear ⇒ Object
31 32 33 |
# File 'lib/openphar/registry/publisher_registry.rb', line 31 def clear @registry = nil end |
.get(code) ⇒ Object
8 9 10 11 |
# File 'lib/openphar/registry/publisher_registry.rb', line 8 def get(code) return nil if code.nil? || code.empty? registry[code.to_s.upcase] end |
.namespace_for(code) ⇒ Object
25 26 27 28 29 |
# File 'lib/openphar/registry/publisher_registry.rb', line 25 def namespace_for(code) info = get(code) return nil unless info info[:namespace_module] end |
.register(code, info) ⇒ Object
13 14 15 |
# File 'lib/openphar/registry/publisher_registry.rb', line 13 def register(code, info) registry[code.to_s.upcase] = info end |
.registered?(code) ⇒ Boolean
17 18 19 |
# File 'lib/openphar/registry/publisher_registry.rb', line 17 def registered?(code) !get(code).nil? end |