explore_rb 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e789a5bea07085d3d886cdc7bad1ef239e077032
4
- data.tar.gz: bbf83d6df5a2867654cb299f47227b2d60d8b0ad
3
+ metadata.gz: 90cd8245889b92d657f766767017f992d81141af
4
+ data.tar.gz: 2f5ff08ba0d7981d6249d5db93b695759be85f35
5
5
  SHA512:
6
- metadata.gz: 8be37b2381362b8a395cce21984c59b4143e92224931675035b1070f5762891f3f37f75650b8e8c76aa9e2712eb635839608e845ce3c4182fb970514533b2fdb
7
- data.tar.gz: 59a5ab6e3fd7a7341896251186209b0b91c50c3300f0973a8d6620f6f13c03485ac1b7a41f0f3848d01c114c4bfbf3d710887607815a8c9daa358fcafc025707
6
+ metadata.gz: 3f3e6ad9a15891b766ce2e4e809e39e0383a7c0fb059cc7326a356c72204642dd717ab9fdb4d0a3df9f0c86df6b83d796902704c8daeaea79ecf1e7c02c89df8
7
+ data.tar.gz: 75121b4ed58be433ef85efd582064b737cf76766e91d360baa049f4cf5d10d5a43eb6b9094503165be6107b53ae65e1f411e445f2775c710f95f0c2d897670df
data/README.md CHANGED
@@ -72,6 +72,33 @@ The greeting message displayed when this library is required mentions
72
72
  this library but it was worth pointing out since fits in with what this library
73
73
  is trying to accomplish.
74
74
 
75
+ ### Garbage Collection
76
+
77
+ There are also methods "start_garbage_collection" and "stop_garbage_collection"
78
+ to allow people to experiment with the Ruby garbage collector:
79
+
80
+ $ class Person; end
81
+ $=> nil
82
+ $ bob = Person.new
83
+ $=> #<Person:0x007fc63e503b90>
84
+ $ Person.new
85
+ $=> #<Person:0x007fc63e507920>
86
+ $ Person.new
87
+ $=> #<Person:0x007fc63e5041a8>
88
+ $ get_objects Person
89
+ $=> [#<Person:0x007fc63e503b90>, #<Person:0x007fc63e5041a8>, #<Person:0x007fc63e507920>]
90
+ $ start_garbage_collection
91
+ $=> nil
92
+ $ get_objects Person
93
+ $=> [#<Person:0x007fc63e503b90>]
94
+ $ bob = nil
95
+ $=> nil
96
+ $ get_objects Person
97
+ $=> []
98
+
99
+
100
+
101
+
75
102
  ## Contributing
76
103
 
77
104
  1. Fork it
@@ -1,3 +1,3 @@
1
1
  module ExploreRb
2
- VERSION = "0.0.1"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/explore_rb.rb CHANGED
@@ -3,11 +3,11 @@ require "explore_rb/version"
3
3
 
4
4
  module ExploreRb
5
5
 
6
- include GC
7
-
8
6
  def self.extended base
9
7
  puts "Use the following commands to look around:"
10
- puts "classes, objects, get_objects, symbols, local_variables, gems, draw_this, help"
8
+ puts " classes, objects, get_objects, symbols, gems,"
9
+ puts " local_variables, draw_this, start_garbage_collection"
10
+ puts " stop_garbage_collection, help"
11
11
  end
12
12
 
13
13
  def classes
@@ -42,14 +42,15 @@ module ExploreRb
42
42
  puts "File saved in #{path}."
43
43
  end
44
44
 
45
- def collect_garbage
46
- GC.stress = true # enable hyperactive garbage collection
47
- garbage_collect
48
- GC.stress = false
49
- #puts "Dumped #{GC.stat[:total_freed_object]} objects from memory"
50
- GC.stat
45
+ def start_garbage_collection
46
+ ENV['RUBY_GC_MALLOC_LIMIT']='0'
47
+ GC.stress=true
48
+ GC.start
51
49
  end
52
50
 
51
+ def stop_garbage_collection
52
+ GC.stress=false
53
+ end
53
54
 
54
55
  end
55
56
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: explore_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Williamson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-23 00:00:00.000000000 Z
11
+ date: 2013-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: traceur