Class: TipTap::Registry
- Inherits:
-
Object
- Object
- TipTap::Registry
- Defined in:
- lib/tip_tap/registry.rb
Constant Summary collapse
- MissingNodeError =
Class.new(StandardError)
Class Method Summary collapse
Class Method Details
.clear ⇒ Object
19 20 21 |
# File 'lib/tip_tap/registry.rb', line 19 def self.clear @registry = {} end |
.node_for(name) ⇒ Object
15 16 17 |
# File 'lib/tip_tap/registry.rb', line 15 def self.node_for(name) registry.fetch(name.to_s) { raise MissingNodeError.new("Unknown node type: #{name}") } end |
.register(name, klass) ⇒ Object
11 12 13 |
# File 'lib/tip_tap/registry.rb', line 11 def self.register(name, klass) registry[name.to_s] = klass end |
.registry ⇒ Object
23 24 25 |
# File 'lib/tip_tap/registry.rb', line 23 def self.registry @registry ||= {} end |