Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

! Renamed Flog#methods to #method_scores. (makaroni4)

[git-p4: depot-paths = "//src/flog/dev/": change = 8397]
  • Loading branch information...
commit d61d289f36167206e49ded23c7af2f5f3901eb43 1 parent 7feaedb
@zenspider zenspider authored
Showing with 12 additions and 13 deletions.
  1. +8 −9 lib/flog.rb
  2. +3 −3 lib/flog_cli.rb
  3. +1 −1  test/test_flog.rb
View
17 lib/flog.rb
@@ -90,8 +90,7 @@ class Flog < SexpProcessor
# :stopdoc:
attr_accessor :multiplier
attr_reader :calls, :option, :class_stack, :method_stack, :mass, :sclass
- attr_reader :method_locations
- attr_reader :methods, :scores
+ attr_reader :method_locations, :method_scores, :scores
# :startdoc:
@@ -119,8 +118,8 @@ def calculate
each_by_score threshold do |class_method, score, call_list|
klass = class_method.split(/#|::/).first
- methods[klass] << [class_method, score]
- scores[klass] += score
+ method_scores[klass] << [class_method, score]
+ scores[klass] += score
end
end
@@ -329,11 +328,11 @@ def process_until_empty exp
# Reset score data
def reset
- @totals = @total_score = nil
- @multiplier = 1.0
- @calls = Hash.new { |h,k| h[k] = Hash.new 0 }
- @methods = Hash.new { |h,k| h[k] = [] }
- @scores = Hash.new 0
+ @totals = @total_score = nil
+ @multiplier = 1.0
+ @calls = Hash.new { |h,k| h[k] = Hash.new 0 }
+ @method_scores = Hash.new { |h,k| h[k] = [] }
+ @scores = Hash.new 0
end
##
View
6 lib/flog_cli.rb
@@ -8,7 +8,7 @@ class FlogCLI
extend Forwardable
def_delegators :@flog, :average, :calculate, :each_by_score, :option
- def_delegators :@flog, :method_locations, :methods, :reset, :scores
+ def_delegators :@flog, :method_locations, :method_scores, :reset, :scores
def_delegators :@flog, :threshold, :total, :no_method
##
@@ -133,7 +133,7 @@ def self.parse_options args = ARGV
next if self.plugins.empty?
opts.separator "Plugin options:"
- extra = self.methods.grep(/parse_options/) - %w(parse_options)
+ extra = self.method_scores.grep(/parse_options/) - %w(parse_options)
extra.sort.each do |msg|
self.send msg, opts, option
@@ -199,7 +199,7 @@ def output_details_grouped io, threshold = nil
io.puts "%8.1f: %s" % [total, "#{klass} total"]
- methods[klass].each do |name, score|
+ method_scores[klass].each do |name, score|
self.print_score io, name, score
end
end
View
2  test/test_flog.rb
@@ -582,7 +582,7 @@ def test_calculate
@flog.calculate
assert_equal({ 'MyKlass' => 42.0 }, @flog.scores)
- assert_equal({ 'MyKlass' => [["MyKlass::Base#mymethod", 42.0]] }, @flog.methods)
+ assert_equal({ 'MyKlass' => [["MyKlass::Base#mymethod", 42.0]] }, @flog.method_scores)
end
def setup_my_klass
Please sign in to comment.
Something went wrong with that request. Please try again.