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 ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 1.9.2
5
+ - jruby-18mode
6
+ - jruby-19mode
7
+ - rbx-19mode
8
+ - 1.8.7
9
+ - ree
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,9 @@
1
1
  = RubyMass CHANGELOG
2
2
 
3
+ == Version 0.1.2 (January 30, 2013)
4
+
5
+ * Only listing objects which respond to `class` when indexing
6
+
3
7
  == Version 0.1.1 (June 11, 2012)
4
8
 
5
9
  * Renamed Object.references to Object._references
data/Gemfile CHANGED
@@ -13,6 +13,7 @@ end
13
13
 
14
14
  group :gem_test do
15
15
  gem "minitest"
16
- gem "mocha"
16
+ gem "mocha", :require => "mocha/setup"
17
17
  gem "pry"
18
+ gem "rake"
18
19
  end
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Paul Engel
1
+ Copyright (c) 2013 Paul Engel
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
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>Object.count</tt> method:
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
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).tap do |stats|
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]}"
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
- nil
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.
@@ -1,7 +1,7 @@
1
1
  module RubyMass #:nodoc:
2
2
  MAJOR = 0
3
3
  MINOR = 1
4
- TINY = 1
4
+ TINY = 2
5
5
 
6
6
  VERSION = [MAJOR, MINOR, TINY].join(".")
7
7
  end
data/ruby-mass.gemspec CHANGED
@@ -12,5 +12,5 @@ Gem::Specification.new do |gem|
12
12
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
13
13
  gem.name = "ruby-mass"
14
14
  gem.require_paths = ["lib"]
15
- gem.version = "0.1.1"
15
+ gem.version = "0.1.2"
16
16
  end
data/test/test_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require "rubygems"
2
2
  require "bundler"
3
3
 
4
- Bundler.require :gem_default, :gem_test
5
-
6
4
  require "minitest/unit"
7
- require "minitest/autorun"
5
+ require "minitest/autorun"
6
+
7
+ Bundler.require :gem_default, :gem_test
@@ -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.references(Foo, Foo::Bar))
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
- description: Introspect the Ruby Heap by indexing, counting, locating references to and detaching (in order to release) objects - optionally narrowing by namespace
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: "0"
56
- required_rubygems_version: !ruby/object:Gem::Requirement
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: "0"
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.17
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 detaching (in order to release) objects - optionally narrowing by namespace
69
- test_files:
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: