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,
-
Stringprovide a fully qualified path which will have to match IR::Node::QueryMethods#path exactly -
Regexpprovide a pattern that will be tested against the IR::Node::QueryMethods#path -
Procprovide a block. If the block returnstruethe node will be ignored
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 |