Permalink
Browse files

Not using tap within Mass.print (now satisfied?)

  • Loading branch information...
1 parent c10f9f5 commit 73a8f8420d9e73d1738bbc5d0f52323b9f8ad3a7 Paul Engel committed Jun 15, 2012
Showing with 10 additions and 12 deletions.
  1. +10 −12 lib/mass.rb
View
@@ -50,19 +50,17 @@ def count(*mods)
# Prints all object instances within either the whole environment or narrowed by namespace group by class.
#
def print(*mods)
- count(*mods).tap do |stats|
- puts "\n"
- puts "=" * 50
- puts " Objects within #{mods ? "#{mods.collect(&:name).sort} namespace" : "environment"}"
- puts "=" * 50
- stats.keys.sort{|a, b| [stats[b], a] <=> [stats[a], b]}.each do |key|
- puts " #{key}: #{stats[key]}"
- end
- puts " - no objects instantiated -" if stats.empty?
- puts "=" * 50
- puts "\n"
+ stats = count(*mods)
+ puts "\n"
+ puts "=" * 50
+ puts " Objects within #{mods ? "#{mods.collect(&:name).sort} namespace" : "environment"}"
+ puts "=" * 50
+ stats.keys.sort{|a, b| [stats[b], a] <=> [stats[a], b]}.each do |key|
+ puts " #{key}: #{stats[key]}"
end
- nil
+ puts " - no objects instantiated -" if stats.empty?
+ puts "=" * 50
+ puts "\n"
end
# Returns all references to the passed object. You can narrow the namespace of the objects referencing to the object.

0 comments on commit 73a8f84

Please sign in to comment.