Module: DepsGrapher::Visualizer::Registry
- Defined in:
- lib/deps_grapher/visualizer/registry.rb
Class Method Summary collapse
- .available_visualizers ⇒ Object
- .default_visualizer ⇒ Object
- .fetch(key) ⇒ Object
- .register(klass, command_option) ⇒ Object
Class Method Details
.available_visualizers ⇒ Object
15 16 17 |
# File 'lib/deps_grapher/visualizer/registry.rb', line 15 def available_visualizers .map(&:to_s) end |
.default_visualizer ⇒ Object
11 12 13 |
# File 'lib/deps_grapher/visualizer/registry.rb', line 11 def default_visualizer .find(&:default?).to_s end |
.fetch(key) ⇒ Object
7 8 9 |
# File 'lib/deps_grapher/visualizer/registry.rb', line 7 def fetch(key) registry.fetch(key).first end |
.register(klass, command_option) ⇒ Object
19 20 21 22 23 |
# File 'lib/deps_grapher/visualizer/registry.rb', line 19 def register(klass, command_option) raise ArgumentError, "visualizer: `#{klass}` must be a subclass of `DepsGrapher::Visualizer::Base`" unless klass.ancestors.include?(Visualizer::Base) registry[command_option.name] = [klass, command_option] end |