Class: PxGraphViz
- Inherits:
-
GraphVizML
- Object
- GraphVizML
- PxGraphViz
- Defined in:
- lib/pxgraphviz.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
-
#px ⇒ Object
readonly
Returns the value of attribute px.
Instance Method Summary collapse
-
#initialize(s, style: nil, debug: false, fill: '#778833', stroke: '#999999', text_color: '#ffeecc') ⇒ PxGraphViz
constructor
A new instance of PxGraphViz.
Constructor Details
#initialize(s, style: nil, debug: false, fill: '#778833', stroke: '#999999', text_color: '#ffeecc') ⇒ PxGraphViz
Returns a new instance of PxGraphViz.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/pxgraphviz.rb', line 15 def initialize(s, style: nil, debug: false, fill: '#778833', stroke: '#999999', text_color: '#ffeecc') @px = s =~ /^<\?/ ? Polyrex.new.import(s) : Polyrex.new(s) @type = @px.summary[:type] == 'digraph' ? 'dir: forward;' : 'dir: none;' @shape = @px.summary[:shape] || 'ellipse;' style ||= default_stylesheet() doc = Rexslt.new(xslt_stylesheet(), @px.to_xml)\ .to_doc.root.element('nodes') doc.root.elements.first.insert_before Rexle::Element.new('style')\ .add_text style @doc = doc puts 'pxgraphviz: before super'.info if debug super(doc, debug: debug, fill: fill, stroke: stroke, text_color: text_color) @css = " .node ellipse {stroke: #{stroke}; fill: #{fill}} .node text {fill: #{text_color}} .edge path {stroke: #{stroke}} .edge polygon {stroke: #{stroke}; fill: #{stroke}} " end |
Instance Attribute Details
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
13 14 15 |
# File 'lib/pxgraphviz.rb', line 13 def doc @doc end |
#px ⇒ Object (readonly)
Returns the value of attribute px.
13 14 15 |
# File 'lib/pxgraphviz.rb', line 13 def px @px end |