Class: Accessibility::Graph::Node
- Inherits:
-
Object
- Object
- Accessibility::Graph::Node
- 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
- #element ⇒ AX::Element readonly
- #id ⇒ String readonly
Instance Method Summary collapse
-
#initialize(element) ⇒ Node
constructor
A new instance of Node.
- #to_dot ⇒ String
Constructor Details
#initialize(element) ⇒ Node
Returns a new instance of Node.
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
#element ⇒ AX::Element (readonly)
32 33 34 |
# File 'lib/accessibility/graph.rb', line 32 def element @element end |
#id ⇒ String (readonly)
29 30 31 |
# File 'lib/accessibility/graph.rb', line 29 def id @id end |
Instance Method Details
#to_dot ⇒ String
41 42 43 |
# File 'lib/accessibility/graph.rb', line 41 def to_dot "#{@id} #{identifier} [shape=#{shape}] [style=#{style}] [color=#{colour}]" end |