Class: Accessibility::Graph::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/accessibility/graph.rb

Overview

TODO:

Graphs could be nicer looking. That is, nodes could be much more easily identifiable, by allowing different classes to tell the node more about itself. A mixin module/protocol should probably be created, just as with the inspector mixin, and added to abstract base and overridden as needed in subclasses. In this way, an object can be more specific about what shape it is, how it is coloured, etc. Reference: http://www.graphviz.org/doc/info/attrs.html

A node in the UI hierarchy. Used by Accessibility::Graph in order to build Graphviz DOT graphs.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(element) ⇒ Node

Returns a new instance of Node.

Parameters:



35
36
37
38
# File 'lib/accessibility/graph.rb', line 35

def initialize element
  @element = element
  @id      = "element_#{element.object_id}"
end

Instance Attribute Details

#elementAX::Element (readonly)

Returns:



32
33
34
# File 'lib/accessibility/graph.rb', line 32

def element
  @element
end

#idString (readonly)

Returns:

  • (String)


29
30
31
# File 'lib/accessibility/graph.rb', line 29

def id
  @id
end

Instance Method Details

#to_dotString

Returns:

  • (String)


41
42
43
# File 'lib/accessibility/graph.rb', line 41

def to_dot
  "#{@id} #{identifier} [shape=#{shape}] [style=#{style}] [color=#{colour}]"
end