bin/parse_tree_abc in ParseTree-1.3.7 vs bin/parse_tree_abc in ParseTree-1.4.0
- old
+ new
@@ -1,16 +1,23 @@
-#!/usr/local/bin/ruby
+#!/usr/local/bin/ruby -ws
# ABC metric
#
# Assignments, Branches, and Calls
#
# A simple way to measure the complexity of a function or method.
+if defined? $I and String === $I then
+ $I.split(/:/).each do |dir|
+ $: << dir
+ end
+end
+
PARSE_TREE_ABC=true
begin require 'rubygems' rescue LoadError end
+require 'sexp'
require 'parse_tree'
require 'sexp_processor'
old_classes = []
ObjectSpace.each_object(Module) do |klass|
@@ -76,7 +83,7 @@
tb += b
tc += c
tval += val
printf "%3d) %-50s = %2d + %2d + %2d = %6.2f\n", count, name, a, b, c, val
count += 1
-end
+end rescue nil
printf "%3d) %-50s = %2d + %2d + %2d = %6.2f\n", count, "Total", ta, tb, tc, tval