Class: RDG::CFG
- Inherits:
-
Object
- Object
- RDG::CFG
- Defined in:
- lib/rdg/cfg.rb
Class Method Summary collapse
Instance Method Summary collapse
- #edge?(u, v) ⇒ Boolean
-
#initialize(ast) ⇒ CFG
constructor
A new instance of CFG.
- #successors(v) ⇒ Object
- #vertices ⇒ Object
- #write_to_graphic_file(format = 'png', filename = "cfg") ⇒ Object
Constructor Details
Class Method Details
.from_path(path) ⇒ Object
9 10 11 |
# File 'lib/rdg/cfg.rb', line 9 def self.from_path(path) new(Tree::AST.from_path(path)) end |
.from_source(source) ⇒ Object
13 14 15 |
# File 'lib/rdg/cfg.rb', line 13 def self.from_source(source) new(Tree::AST.from_source(source)) end |
Instance Method Details
#edge?(u, v) ⇒ Boolean
35 36 37 |
# File 'lib/rdg/cfg.rb', line 35 def edge?(u, v) @context.graph.has_edge?(u, v) end |
#successors(v) ⇒ Object
31 32 33 |
# File 'lib/rdg/cfg.rb', line 31 def successors(v) @context.graph.each_adjacent(v).to_a end |
#vertices ⇒ Object
27 28 29 |
# File 'lib/rdg/cfg.rb', line 27 def vertices @context.graph.each_vertex.to_a end |
#write_to_graphic_file(format = 'png', filename = "cfg") ⇒ Object
23 24 25 |
# File 'lib/rdg/cfg.rb', line 23 def write_to_graphic_file(format = 'png', filename = "cfg") @context.graph.write_to_graphic_file(format, filename) end |