Archive for the ‘RAKA’ Category
Giving wings to RAKA - graphing ability!
May 28th, 2008
Brightest ideas hit you when you least expect them. I was trying so hard all evening to put RAKA’s output into a format Graphviz could understand - but had no luck. I tried arrays, hashes, stack and what not - but nothing seemed right (or I wasn’t doing it right
) - and at 4am - right at the moment when I was packing up for the night - it hit me! - Just like a big bright Bulb!
Why not XML? Graphviz can very well render an XML (Some examples from ruby-graphviz gem) - and I was already able to output my tree in much similar format - whoa! 5 more minutes and I had this…

Read the graph - left to right, top to bottom. If X is displayed before Y in the graph, X is coded before Y.
And this is the code it corresponds to…
-
-
require "pp"
-
-
module Junk
-
-
class Maku
-
-
def say_hello(str)
-
puts "hello #{str}"
-
a = 1+1
-
if a == 2
-
if a == 1
-
puts "Yahoo"
-
if a == 10
-
puts "Microsoft"
-
else
-
puts "Google"
-
end
-
end
-
pp a
-
else
-
puts "bye"
-
end
-
puts ""
-
puts ""
-
end
-
end
-
-
end
Here is a side-by-side comparison of the output
The graph seems more like in vertical direction - however a more horizontal direction would look much better - what say?
Oh yes, I have a new expansion for RAKA - “A Ruby Klass Analyzer” ![]()
Posted in RAKA, Ruby | Comments (2)
