Class: Sequel::ToDot
Defined Under Namespace
Modules: DatasetMethods
Constant Summary collapse
- TO_DOT_OPTIONS =
The option keys that should be included in the dot output.
[:with, :distinct, :select, :from, :join, :where, :group, :having, :compounds, :order, :limit, :offset, :lock].freeze
Class Method Summary collapse
-
.output(ds) ⇒ Object
Given a
Dataset
, return a string indot
format that will generate a visualization of the dataset.
Instance Method Summary collapse
-
#initialize(ds) ⇒ ToDot
constructor
Given a
Dataset
, parse the internal structure to generate a dataset visualization. -
#output ⇒ Object
Output the dataset visualization as a string in
dot
format.
Constructor Details
#initialize(ds) ⇒ ToDot
Given a Dataset
, parse the internal structure to generate a dataset visualization.
37 38 39 40 41 42 43 |
# File 'lib/sequel/extensions/to_dot.rb', line 37 def initialize(ds) @i = 0 @stack = [@i] @dot = ["digraph G {", "0 [label=\"self\"];"] v(ds, "") @dot << "}" end |
Class Method Details
.output(ds) ⇒ Object
Given a Dataset
, return a string in dot
format that will generate a visualization of the dataset.
31 32 33 |
# File 'lib/sequel/extensions/to_dot.rb', line 31 def self.output(ds) new(ds).output end |
Instance Method Details
#output ⇒ Object
Output the dataset visualization as a string in dot
format.
46 47 48 |
# File 'lib/sequel/extensions/to_dot.rb', line 46 def output @dot.join("\n") end |