Method: CodeNode::DSL::GraphDefiner#ignore

Defined in:
lib/code_node/dsl/graph_definer.rb

#ignore(name = nil) {|node| ... } ⇒ nil

Specify an ignore rule for the graph. Nodes matching the ignore rule will not be included in the graph. Ignore rules can be given in one of three ways,

Examples:

CodeNode.graph 'my_graph' do |g|

  # Using a full path
  g.ignore 'Foo::Bar::Car'

  # Using a regular expression
  g.ignore /ClassMethods$/

  # Using a block
  g.ignore do |node|
    node.inherits_from? 'Exception'
  end
end

Yield Parameters:



40
41
42
43
44
45
46
47
# File 'lib/code_node/dsl/graph_definer.rb', line 40

def ignore(name=nil, &block)
  if (name.nil? && block.nil?) || (name && block)
    raise ArgumentError.new('Provide either a name or a block') 
  end
  matcher = IR::NodeMatcher.new name || block
  @graph.instance_eval {@exclude_matchers << matcher}
  nil
end