ruby-mass 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +9 -0
- data/CHANGELOG.rdoc +4 -0
- data/Gemfile +2 -1
- data/MIT-LICENSE +1 -1
- data/README.rdoc +2 -2
- data/VERSION +1 -1
- data/lib/mass.rb +11 -13
- data/lib/ruby-mass/version.rb +1 -1
- data/ruby-mass.gemspec +1 -1
- data/test/test_helper.rb +3 -3
- data/test/unit/test_mass.rb +1 -1
- metadata +31 -31
data/.travis.yml
ADDED
data/CHANGELOG.rdoc
CHANGED
data/Gemfile
CHANGED
data/MIT-LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
== RubyMass
|
1
|
+
== RubyMass {<img src="https://secure.travis-ci.org/archan937/ruby-mass.png">}[http://travis-ci.org/archan937/ruby-mass]
|
2
2
|
|
3
3
|
Introspect the Ruby Heap by indexing, counting, locating references to and detaching (in order to release) objects - optionally narrowing by namespace.
|
4
4
|
|
@@ -78,7 +78,7 @@ Continueing with the previous example, you will get the following results:
|
|
78
78
|
|
79
79
|
==== Pretty print the amount of objects in memory
|
80
80
|
|
81
|
-
You can also pretty print the result of the <tt>
|
81
|
+
You can also pretty print the result of the <tt>Mass.count</tt> method:
|
82
82
|
|
83
83
|
|
84
84
|
$ Mass.print Foo
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/mass.rb
CHANGED
@@ -33,7 +33,7 @@ module Mass
|
|
33
33
|
#
|
34
34
|
def index(*mods)
|
35
35
|
instances_within(*mods).inject({}) do |hash, object|
|
36
|
-
((hash[object.class.name] ||= []) << object.object_id).sort!
|
36
|
+
((hash[object.class.name] ||= []) << object.object_id).sort! if object.respond_to?(:class)
|
37
37
|
hash
|
38
38
|
end
|
39
39
|
end
|
@@ -50,19 +50,17 @@ module Mass
|
|
50
50
|
# Prints all object instances within either the whole environment or narrowed by namespace group by class.
|
51
51
|
#
|
52
52
|
def print(*mods)
|
53
|
-
count(*mods)
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
end
|
61
|
-
puts " - no objects instantiated -" if stats.empty?
|
62
|
-
puts "=" * 50
|
63
|
-
puts "\n"
|
53
|
+
stats = count(*mods)
|
54
|
+
puts "\n"
|
55
|
+
puts "=" * 50
|
56
|
+
puts " Objects within #{mods ? "#{mods.collect(&:name).sort} namespace" : "environment"}"
|
57
|
+
puts "=" * 50
|
58
|
+
stats.keys.sort{|a, b| [stats[b], a] <=> [stats[a], b]}.each do |key|
|
59
|
+
puts " #{key}: #{stats[key]}"
|
64
60
|
end
|
65
|
-
|
61
|
+
puts " - no objects instantiated -" if stats.empty?
|
62
|
+
puts "=" * 50
|
63
|
+
puts "\n"
|
66
64
|
end
|
67
65
|
|
68
66
|
# Returns all references to the passed object. You can narrow the namespace of the objects referencing to the object.
|
data/lib/ruby-mass/version.rb
CHANGED
data/ruby-mass.gemspec
CHANGED
data/test/test_helper.rb
CHANGED
data/test/unit/test_mass.rb
CHANGED
@@ -124,7 +124,7 @@ module Unit
|
|
124
124
|
assert_equal({
|
125
125
|
"Unit::TestMass::Foo##{f2.object_id}" => ["@foo"],
|
126
126
|
"Unit::TestMass::Foo::Bar##{b.object_id}" => ["@fool"]
|
127
|
-
}, f1.
|
127
|
+
}, f1._references(Foo, Foo::Bar))
|
128
128
|
|
129
129
|
assert_equal({
|
130
130
|
"Unit::TestMass::Foo::Bar##{b.object_id}" => ["@fool"]
|
metadata
CHANGED
@@ -1,29 +1,26 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-mass
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
4
5
|
prerelease:
|
5
|
-
version: 0.1.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Paul Engel
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
date: 2012-06-11 00:00:00 Z
|
12
|
+
date: 2013-01-30 00:00:00.000000000 Z
|
14
13
|
dependencies: []
|
15
|
-
|
16
|
-
|
17
|
-
email:
|
14
|
+
description: Introspect the Ruby Heap by indexing, counting, locating references to
|
15
|
+
and detaching (in order to release) objects - optionally narrowing by namespace
|
16
|
+
email:
|
18
17
|
- paul.engel@holder.nl
|
19
18
|
executables: []
|
20
|
-
|
21
19
|
extensions: []
|
22
|
-
|
23
20
|
extra_rdoc_files: []
|
24
|
-
|
25
|
-
files:
|
21
|
+
files:
|
26
22
|
- .gitignore
|
23
|
+
- .travis.yml
|
27
24
|
- CHANGELOG.rdoc
|
28
25
|
- Gemfile
|
29
26
|
- MIT-LICENSE
|
@@ -41,32 +38,35 @@ files:
|
|
41
38
|
- test/unit/test_mass.rb
|
42
39
|
homepage: https://github.com/archan937/ruby-mass
|
43
40
|
licenses: []
|
44
|
-
|
45
41
|
post_install_message:
|
46
42
|
rdoc_options: []
|
47
|
-
|
48
|
-
require_paths:
|
43
|
+
require_paths:
|
49
44
|
- lib
|
50
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
46
|
none: false
|
52
|
-
requirements:
|
53
|
-
- -
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version:
|
56
|
-
|
47
|
+
requirements:
|
48
|
+
- - ! '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
segments:
|
52
|
+
- 0
|
53
|
+
hash: 25303399653673022
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
55
|
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version:
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
hash: 25303399653673022
|
62
63
|
requirements: []
|
63
|
-
|
64
64
|
rubyforge_project:
|
65
|
-
rubygems_version: 1.8.
|
65
|
+
rubygems_version: 1.8.24
|
66
66
|
signing_key:
|
67
67
|
specification_version: 3
|
68
|
-
summary: Introspect the Ruby Heap by indexing, counting, locating references to and
|
69
|
-
|
68
|
+
summary: Introspect the Ruby Heap by indexing, counting, locating references to and
|
69
|
+
detaching (in order to release) objects - optionally narrowing by namespace
|
70
|
+
test_files:
|
70
71
|
- test/test_helper.rb
|
71
72
|
- test/unit/test_mass.rb
|
72
|
-
has_rdoc:
|