Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

+ class_stack now always pushes on symbols or strings for class names.

- Fixed klass_name returning an ugly mix of sexps and strings.
[git-p4: depot-paths = "//src/flog/dev/": change = 6635]
  • Loading branch information...
commit 7ea86d19ae120394a1aad9eeba3a6b7396b99b46 1 parent 4481acc
@zenspider zenspider authored
Showing with 18 additions and 11 deletions.
  1. +18 −11 lib/flog.rb
View
29 lib/flog.rb
@@ -263,6 +263,20 @@ def flog(*files_or_dirs)
# Adds name to the class stack, for the duration of the block
def in_klass name
+ if Sexp === name then
+ name = case name.first
+ when :colon2 then
+ name = name.flatten
+ name.delete :const
+ name.delete :colon2
+ name.join("::")
+ when :colon3 then
+ name.last.to_s
+ else
+ raise "unknown type #{name.inspect}"
+ end
+ end
+
@class_stack.unshift name
yield
@class_stack.shift
@@ -297,18 +311,9 @@ def initialize option = {}
def klass_name
name = @class_stack.first
+
if Sexp === name then
- case name.first
- when :colon2 then
- name = name.flatten
- name.delete :const
- name.delete :colon2
- name.join("::")
- when :colon3 then
- name.last.to_s
- else
- name
- end
+ raise "you shouldn't see me"
elsif @class_stack.any?
@class_stack.reverse.join("::")
else
@@ -334,6 +339,7 @@ def output_details io, max = nil
each_by_score max do |class_method, score, call_list|
return 0 if option[:methods] and class_method =~ /##{@@no_method}/
+
self.print_score io, class_method, score
if option[:details] then
@@ -365,6 +371,7 @@ def output_details_grouped io, max = nil
io.puts
io.puts "%8.1f: %s" % [total, "#{klass} total"]
+
methods[klass].each do |name, score|
self.print_score io, name, score
end
Please sign in to comment.
Something went wrong with that request. Please try again.