Class: ConceptQL::Graph
- Inherits:
-
Object
- Object
- ConceptQL::Graph
- Defined in:
- lib/conceptql/graph.rb
Instance Attribute Summary collapse
-
#dangler ⇒ Object
readonly
Returns the value of attribute dangler.
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#g ⇒ Object
readonly
Returns the value of attribute g.
-
#statement ⇒ Object
readonly
Returns the value of attribute statement.
-
#suffix ⇒ Object
readonly
Returns the value of attribute suffix.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #graph ⇒ Object
- #graph_it(file_path) ⇒ Object
-
#initialize(statement, opts = {}) ⇒ Graph
constructor
A new instance of Graph.
Constructor Details
#initialize(statement, opts = {}) ⇒ Graph
Returns a new instance of Graph.
10 11 12 13 14 15 16 17 18 |
# File 'lib/conceptql/graph.rb', line 10 def initialize(statement, opts = {}) @statement = statement @db = opts.fetch(:db, nil) @dangler = opts.fetch(:dangler, false) @tree = opts.fetch(:tree, Tree.new) @title = opts.fetch(:title, nil) @suffix = opts.fetch(:suffix, 'pdf') ConceptQL::Operators::Operator.send(:include, ConceptQL::Behaviors::Dottable) end |
Instance Attribute Details
#dangler ⇒ Object (readonly)
Returns the value of attribute dangler.
9 10 11 |
# File 'lib/conceptql/graph.rb', line 9 def dangler @dangler end |
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
9 10 11 |
# File 'lib/conceptql/graph.rb', line 9 def file_path @file_path end |
#g ⇒ Object (readonly)
Returns the value of attribute g.
9 10 11 |
# File 'lib/conceptql/graph.rb', line 9 def g @g end |
#statement ⇒ Object (readonly)
Returns the value of attribute statement.
9 10 11 |
# File 'lib/conceptql/graph.rb', line 9 def statement @statement end |
#suffix ⇒ Object (readonly)
Returns the value of attribute suffix.
9 10 11 |
# File 'lib/conceptql/graph.rb', line 9 def suffix @suffix end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
9 10 11 |
# File 'lib/conceptql/graph.rb', line 9 def title @title end |
Instance Method Details
#graph ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/conceptql/graph.rb', line 25 def graph @graph ||= begin opts = { type: :digraph } opts[:label] = title if title GraphViz.new(:G, opts) end end |
#graph_it(file_path) ⇒ Object
20 21 22 23 |
# File 'lib/conceptql/graph.rb', line 20 def graph_it(file_path) build_graph(g) graph.output(suffix.to_sym => file_path + ".#{suffix}") end |