Module: CodeNode

Extended by:
Cog::Generator
Defined in:
lib/code_node.rb,
lib/code_node/ir.rb,
lib/code_node/dsl.rb,
lib/code_node/ir/node.rb,
lib/code_node/ir/graph.rb,
lib/code_node/sexp_walker.rb,
lib/code_node/spec_helpers.rb,
lib/code_node/graph_builder.rb,
lib/code_node/ir/node_matcher.rb,
lib/code_node/dsl/graph_definer.rb,
lib/code_node/ir/node/query_methods.rb,
lib/code_node/spec_helpers/dot_file.rb,
lib/code_node/ir/node/builder_methods.rb,
lib/code_node/ir/graph/builder_methods.rb,
lib/code_node/ir/node/template_methods.rb,
lib/code_node/ir/graph/template_methods.rb

Overview

Create Class and Module graphs for Ruby prjects

Defined Under Namespace

Modules: DSL, IR, SpecHelpers Classes: GraphBuilder, SexpWalker

Class Method Summary collapse

Class Method Details

.graph(graph_name, opt = {}) {|graph| ... } ⇒ Object

Parameters:

  • graph_name (String)

    name of the dot file to generate (without .dot extension)

  • opt (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opt):

  • :ruby_version (Symbol) — default: :ruby19

    either :ruby18 or :ruby19, indicating which parser to use

Yield Parameters:



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/code_node.rb', line 18

def self.graph(graph_name, opt={}, &block)
  parser = if opt[:ruby_version] == :ruby18
    Ruby18Parser.new
  else
    Ruby19Parser.new
  end

  GraphBuilder.new(graph_name, parser).
    define(&block).
    find_nodes.
    find_relations.
    finalize.
    render
end