Class: DiverDown::Web::DefinitionToDot
- Inherits:
-
Object
- Object
- DiverDown::Web::DefinitionToDot
- Defined in:
- lib/diver_down/web/definition_to_dot.rb
Defined Under Namespace
Classes: DotMetadataStore
Constant Summary collapse
- ATTRIBUTE_DELIMITER =
' '- MODULE_MINLEN =
Between modules is prominently distanced
3
Instance Method Summary collapse
- #dot_metadata ⇒ Array<Hash>
-
#initialize(definition, metadata, compound: false, concentrate: false, only_module: false) ⇒ DefinitionToDot
constructor
A new instance of DefinitionToDot.
- #to_s ⇒ String
Constructor Details
#initialize(definition, metadata, compound: false, concentrate: false, only_module: false) ⇒ DefinitionToDot
Returns a new instance of DefinitionToDot.
135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/diver_down/web/definition_to_dot.rb', line 135 def initialize(definition, , compound: false, concentrate: false, only_module: false) @definition = definition @metadata = @io = DiverDown::Web::IndentedStringIo.new @indent = 0 @compound = compound || only_module # When only-module is enabled, dependencies between modules are displayed as compound. @compound_map = Hash.new { |h, k| h[k] = {} } # Hash{ ltail => Hash{ lhead => issued id } } @concentrate = concentrate @only_module = only_module @dot_metadata_store = DotMetadataStore.new() end |
Instance Method Details
#dot_metadata ⇒ Array<Hash>
148 149 150 |
# File 'lib/diver_down/web/definition_to_dot.rb', line 148 def @dot_metadata_store.to_a end |
#to_s ⇒ String
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/diver_down/web/definition_to_dot.rb', line 153 def to_s io.puts %(strict digraph "#{escape_quote(definition.title)}" {) io.indented do io.puts('compound=true') if @compound io.puts('concentrate=true') if @concentrate if @only_module render_only_modules else render_sources end end io.puts '}' io.string end |