Class: RGL::DOT::Port

### Home Classes Methods

### In Files

- lib/rgl/rdot.rb

### Parent

Object

### Methods

- ::new
- #to_s

### Class/Module Index

Quicksearch

- RGL
- RGL::AdjacencyGraph
- RGL::BFSIterator
- RGL::BellmanFordAlgorithm
- RGL::BellmanFordVisitor
- RGL::BidirectionalGraph
- RGL::BipartiteBFSIterator
- RGL::DFSIterator
- RGL::DFSVisitor
- RGL::DOT
- RGL::DOT::Digraph
- RGL::DOT::DirectedEdge
- RGL::DOT::Edge
- RGL::DOT::Element
- RGL::DOT::Graph
- RGL::DOT::Node
- RGL::DOT::Port
- RGL::DOT::Subgraph
- RGL::DijkstraAlgorithm
- RGL::DijkstraVisitor
- RGL::DirectedAdjacencyGraph
- RGL::Edge
- RGL::Edge::DirectedEdge
- RGL::Edge::UnDirectedEdge
- RGL::EdgePropertiesMap
- RGL::EdmondsKarpAlgorithm
- RGL::EdmondsKarpAlgorithm::EdmondsKarpBFSIterator
- RGL::Graph
- RGL::Graph::TarjanSccVisitor
- RGL::GraphIterator
- RGL::GraphVisitor
- RGL::GraphVisitor::ClassMethods
- RGL::GraphVisitor::DistanceMapSupport
- RGL::ImplicitGraph
- RGL::MutableGraph
- RGL::MutableGraph::MutableGraphParser
- RGL::NoEdgeError
- RGL::NoVertexError
- RGL::NonNegativeEdgePropertiesMap
- RGL::NotDirectedError
- RGL::NotUndirectedError
- RGL::PrimAlgorithm
- RGL::TopsortIterator
- Enumerable
- Object

No matching classes.

# RGL::DOT::Port

Ports are used when a Node instance has its `shape' option set to record or Mrecord. Ports can be nested.

### Attributes

label[RW]
name[RW]
ports[RW]

### Public Class Methods

new(name = nil, label = nil) click to toggle source
new(ports)

Create a new port with either an optional name and label or a set of nested ports.

A `nil` value for `name` is valid; otherwise, it must be a String or it will be interpreted as `ports`.

    # File lib/rgl/rdot.rb, line 208
    def initialize(name_or_ports = nil, label = nil)
      if name_or_ports.nil? || name_or_ports.kind_of?(String)
        @name  = name_or_ports
        @label = label
        @ports = nil
      else
        @ports = name_or_ports
        @name  = nil
        @label = nil
      end
    end

### Public Instance Methods

to_s() click to toggle source

Returns a string representation of this port. If ports is a non-empty Enumerable, a nested ports representation is returned; otherwise, a name-label representation is returned.

    # File lib/rgl/rdot.rb, line 224
    def to_s
      if @ports.nil? || @ports.empty?
        n = (name.nil? || name.empty?) ? '' : "<#{name}>"
        n + ((n.empty? || label.nil? || label.empty?) ? '' : ' ') + label.to_s
      else
        '{' + @ports.collect { |p| p.to_s }.join(' | ') + '}'
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.