Class: VisualizeRuby::Graph
- Inherits:
-
Object
- Object
- VisualizeRuby::Graph
- Defined in:
- lib/visualize_ruby/graph.rb
Instance Attribute Summary collapse
-
#edges ⇒ Object
readonly
Returns the value of attribute edges.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
Instance Method Summary collapse
-
#initialize(ruby_code:, name: nil) ⇒ Graph
constructor
A new instance of Graph.
- #to_hash ⇒ Object
Constructor Details
Instance Attribute Details
#edges ⇒ Object (readonly)
Returns the value of attribute edges.
3 4 5 |
# File 'lib/visualize_ruby/graph.rb', line 3 def edges @edges end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/visualize_ruby/graph.rb', line 3 def name @name end |
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
3 4 5 |
# File 'lib/visualize_ruby/graph.rb', line 3 def nodes @nodes end |
Instance Method Details
#to_hash ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/visualize_ruby/graph.rb', line 10 def to_hash { name: name, edges: edges.map(&:to_a), nodes: nodes.map(&:to_a), } end |