20 May 2007

visualize.rb

Here is a small script (visualize.rb) that helps me visualize the Structure of Ruby code. Before I jump into the source, I want to see the "big" picture of things. This script helps me with that. [There is a small bug with the script -- see the source for more details.]

Here it is being run on itself:
module Visualize
  class Construct
    def initialize
    def self.fromtree
    def to_a
    def same
    def merge
    def pp
  class SourceFile
    def initialize
    def collect_requires
    def collect_tokens
    class StatementModifier
      def initialize
    def mark_statement_modifiers
    def getname
    def gather
    def pp
    def merge
  class SourcePackage
    def initialize
    def pp
def opt?
def print_tokens
def main
And here is the code structure of Capistrano:
module Capistrano
  class ServerDefinition
    def initialize
    def <=>
    def eql?
    def hash
    def to_s
  class Command
    def self.process
    def initialize
    def process!
    def stop!
    def logger
    def open_channels
    def replace_placeholders
    def extract_environment
...
...
   class RemoteDependency
      def initialize
      def directory
      def writable
      def command
      def gem
      def or
      def pass?
      def message
      def try
def depend