Class: DotR::Connection

Inherits:
Object
  • Object
show all
Includes:
Styled
Defined in:
lib/dotr.rb

Overview

Represents a connection between two nodes in a digraph. Instances of this class are created by calling Digraph#connection or Node#connection.

Specify styles on this object by setting instance attributes. Possible attributes include ‘label’ and ‘shape’; the attribute names and possible values correspond to the style attributes described in the ‘dot’ manual.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Styled

#method_missing, #style

Constructor Details

#initialize(from_name, to_name, style = {}) {|_self| ... } ⇒ Connection

:nodoc:

Yields:

  • (_self)

Yield Parameters:



157
158
159
160
161
162
# File 'lib/dotr.rb', line 157

def initialize(from_name, to_name, style={}, &block)  #:nodoc:
  @from_name = from_name
  @to_name = to_name
  style_attrs.update(style)
  yield self if block
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class DotR::Styled

Instance Attribute Details

#from_nameObject (readonly)

Returns the value of attribute from_name.



155
156
157
# File 'lib/dotr.rb', line 155

def from_name
  @from_name
end

#to_nameObject (readonly)

Returns the value of attribute to_name.



155
156
157
# File 'lib/dotr.rb', line 155

def to_name
  @to_name
end

Instance Method Details

#render_to(output_lines, indent) ⇒ Object

:nodoc:



164
165
166
# File 'lib/dotr.rb', line 164

def render_to(output_lines, indent)  # :nodoc:
  output_lines << "#{indent}\"#{from_name}\" -> \"#{to_name}\"" + style + ";"
end