weakling 0.0.4-java → 0.0.5.pre0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/HISTORY.txt +4 -0
- data/lib/refqueue.jar +0 -0
- data/spec/idhash_spec.rb +30 -0
- data/spec/weakref_spec.rb +42 -0
- data/weakling.gemspec +4 -4
- metadata +43 -61
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d9694f07c22f2bb9a009bc339a708415066e9691223491c51652125f18bedd8b
|
4
|
+
data.tar.gz: e9b7ecbf039e65f805972d9314955779ad4c42490e61b8e65f7dc32cdaa2d5e8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 66cf6d2ff32307b379d5cfa8f85cfbe4eaf3531450604c8debadd230422ec16126d35a56b941cb264fdbd824bcd3a0bc464a4ac3ef2345b748a9da6725ee5ae2
|
7
|
+
data.tar.gz: 42fd4019da329e9ecd14f1a644a5cb94de9505e182b59021eaf3c8f389e21beb27084bcdfb1494916dcac114b0081bef97955e8beea5f264779db6ce4d34826f
|
data/HISTORY.txt
CHANGED
data/lib/refqueue.jar
CHANGED
Binary file
|
data/spec/idhash_spec.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require "weakling"
|
2
|
+
require "jruby"
|
3
|
+
|
4
|
+
describe Weakling::IdHash do
|
5
|
+
before(:each) do
|
6
|
+
@id_hash = Weakling::IdHash.new
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should hold mappings from id to object" do
|
10
|
+
ary = (1..10).to_a.map {Object.new}
|
11
|
+
ids = ary.map {|o| @id_hash.add(o)}
|
12
|
+
|
13
|
+
ids.each do |id|
|
14
|
+
@id_hash[id].should_not == nil
|
15
|
+
ary.should include(@id_hash[id])
|
16
|
+
end
|
17
|
+
ids.sort.should == ary.map(&:__id__).sort
|
18
|
+
@id_hash.to_a.sort.should == ary.map{|obj| [obj.__id__, obj]}.sort
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should weakly reference the objects" do
|
22
|
+
ary = (1..10).to_a.map {Object.new}
|
23
|
+
ids = ary.map {|o| @id_hash.add(o)}
|
24
|
+
ary = nil
|
25
|
+
|
26
|
+
JRuby.gc
|
27
|
+
|
28
|
+
@id_hash.to_a.should be_empty
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'weakling'
|
2
|
+
require 'jruby'
|
3
|
+
|
4
|
+
describe Weakling::WeakRef do
|
5
|
+
it "holds a reference to an object" do
|
6
|
+
o = Object.new
|
7
|
+
w = Weakling::WeakRef.new(o)
|
8
|
+
w.get.should equal(o)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "weakly references the contained object" do
|
12
|
+
o = Object.new
|
13
|
+
w = Weakling::WeakRef.new(o)
|
14
|
+
o = nil
|
15
|
+
5.times {JRuby.gc}
|
16
|
+
|
17
|
+
lambda {w.get}.should raise_error RefError
|
18
|
+
w.weakref_alive?.should == false
|
19
|
+
end
|
20
|
+
|
21
|
+
it "accepts a RefQueue for reporting collected refs" do
|
22
|
+
o1 = Object.new
|
23
|
+
o2 = Object.new
|
24
|
+
r = Weakling::RefQueue.new
|
25
|
+
w1 = Weakling::WeakRef.new(o1, r)
|
26
|
+
w2 = Weakling::WeakRef.new(o2, r)
|
27
|
+
|
28
|
+
r.poll.should == nil
|
29
|
+
r.remove(50).should == nil
|
30
|
+
|
31
|
+
o1 = nil
|
32
|
+
5.times {JRuby.gc}
|
33
|
+
|
34
|
+
r.poll.should == w1
|
35
|
+
|
36
|
+
o2 = nil
|
37
|
+
5.times {JRuby.gc}
|
38
|
+
|
39
|
+
r.remove.should == w2
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
data/weakling.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{weakling}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.5.pre0"
|
6
6
|
s.authors = ["Charles Oliver Nutter"]
|
7
|
-
s.date = Time.now.strftime('
|
7
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
8
8
|
s.description = "A modified WeakRef impl for JRuby plus some weakref-related tools"
|
9
9
|
s.email = ["headius@headius.com"]
|
10
|
-
s.files = Dir['{lib,ext,examples,
|
10
|
+
s.files = Dir['{lib,ext,examples,spec}/**/*'] + Dir['{*.txt,*.gemspec,Rakefile}']
|
11
11
|
s.homepage = "http://github.com/headius/weakling"
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.summary = "A modified WeakRef impl for JRuby plus some weakref-related tools"
|
14
|
-
s.test_files = Dir["
|
14
|
+
s.test_files = Dir["spec/*_spec.rb"]
|
15
15
|
s.platform = "java"
|
16
16
|
end
|
metadata
CHANGED
@@ -1,75 +1,57 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: weakling
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 4
|
9
|
-
version: 0.0.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5.pre0
|
10
5
|
platform: java
|
11
|
-
authors:
|
12
|
-
|
13
|
-
autorequire:
|
6
|
+
authors:
|
7
|
+
- Charles Oliver Nutter
|
8
|
+
autorequire:
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
|
-
|
17
|
-
date: 2010-06-03 18:51:00.994000 -05:00
|
18
|
-
default_executable:
|
11
|
+
date: 2021-10-07 00:00:00.000000000 Z
|
19
12
|
dependencies: []
|
20
|
-
|
21
13
|
description: A modified WeakRef impl for JRuby plus some weakref-related tools
|
22
|
-
email:
|
23
|
-
|
14
|
+
email:
|
15
|
+
- headius@headius.com
|
24
16
|
executables: []
|
25
|
-
|
26
17
|
extensions: []
|
27
|
-
|
28
18
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
19
|
+
files:
|
20
|
+
- HISTORY.txt
|
21
|
+
- README.txt
|
22
|
+
- Rakefile
|
23
|
+
- examples/id_hash.rb
|
24
|
+
- examples/refqueue_use.rb
|
25
|
+
- ext/RefqueueService.java
|
26
|
+
- ext/org/jruby/ext/RefQueueLibrary.java
|
27
|
+
- lib/refqueue.jar
|
28
|
+
- lib/weakling.rb
|
29
|
+
- lib/weakling/collections.rb
|
30
|
+
- spec/idhash_spec.rb
|
31
|
+
- spec/weakref_spec.rb
|
32
|
+
- weakling.gemspec
|
43
33
|
homepage: http://github.com/headius/weakling
|
44
34
|
licenses: []
|
45
|
-
|
46
|
-
post_install_message:
|
35
|
+
metadata: {}
|
36
|
+
post_install_message:
|
47
37
|
rdoc_options: []
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
none: false
|
61
|
-
requirements:
|
62
|
-
- - ">="
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
segments:
|
65
|
-
- 0
|
66
|
-
version: "0"
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 1.3.1
|
67
50
|
requirements: []
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
signing_key:
|
72
|
-
specification_version: 3
|
51
|
+
rubygems_version: 3.2.14
|
52
|
+
signing_key:
|
53
|
+
specification_version: 4
|
73
54
|
summary: A modified WeakRef impl for JRuby plus some weakref-related tools
|
74
|
-
test_files:
|
75
|
-
|
55
|
+
test_files:
|
56
|
+
- spec/idhash_spec.rb
|
57
|
+
- spec/weakref_spec.rb
|