utilrb 0.2 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Changes.txt +16 -4
- data/Manifest.txt +2 -0
- data/README.txt +1 -1
- data/Rakefile +2 -2
- data/lib/utilrb/array/to_s.rb +1 -1
- data/lib/utilrb/common.rb +1 -1
- data/lib/utilrb/hash/to_s.rb +1 -1
- data/lib/utilrb/module/ancestor_p.rb +1 -1
- data/lib/utilrb/queue/get.rb +17 -0
- data/lib/utilrb/queue.rb +2 -0
- data/test/test_array.rb +1 -1
- data/test/test_gc.rb +0 -5
- data/test/test_hash.rb +1 -1
- data/test/test_object.rb +1 -1
- metadata +14 -3
data/Changes.txt
CHANGED
@@ -1,11 +1,23 @@
|
|
1
|
+
=== Version 0.2.2
|
2
|
+
The "don't forget to bump version number" release. 0.2 was supposed to be 0.2.1
|
3
|
+
|
4
|
+
* new features:
|
5
|
+
- Queue#get: waits for the queue to be not empty and returns all elements at
|
6
|
+
once. A non_block parameter is given which makes get() return [] if the
|
7
|
+
queue is empty
|
8
|
+
|
9
|
+
* changes:
|
10
|
+
- Array#to_s and Hash#to_s now enclose the result in [] and {}. The difference
|
11
|
+
with #inspect is that we call #to_s on the elements.
|
12
|
+
|
1
13
|
=== Version 0.2.1
|
2
14
|
* new features:
|
3
|
-
- is_singleton?
|
4
|
-
- inherited_enumerable (class_inherited_enumerable on steroids)
|
5
|
-
- attribute() can be used in singleton classes (previously we had to
|
15
|
+
- Kernel#is_singleton?
|
16
|
+
- Module#inherited_enumerable (class_inherited_enumerable on steroids)
|
17
|
+
- Module#attribute() can be used in singleton classes (previously we had to
|
6
18
|
call class_attribute() in the class itself)
|
7
19
|
- UnboundMethod#call(obj, *args, &block) calls the method on obj with
|
8
|
-
the provided arguments
|
20
|
+
the provided arguments (does m.bind(obj).call(*args, &block))
|
9
21
|
|
10
22
|
* changes:
|
11
23
|
- changed semantics of Module::include for inclusion of modules in modules:
|
data/Manifest.txt
CHANGED
data/README.txt
CHANGED
data/Rakefile
CHANGED
@@ -6,11 +6,11 @@ Hoe.new('utilrb', Utilrb::VERSION) do |p|
|
|
6
6
|
p.email = "sylvain.joyeux@m4x.org"
|
7
7
|
|
8
8
|
p.summary = 'Yet another Ruby toolkit'
|
9
|
-
p.description = p.paragraphs_of('README.txt',
|
9
|
+
p.description = p.paragraphs_of('README.txt', 3..6).join("\n\n")
|
10
10
|
p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
|
11
11
|
p.changes = p.paragraphs_of('Changes.txt', 0..1).join("\n\n")
|
12
12
|
|
13
|
-
p.extra_deps
|
13
|
+
p.extra_deps << 'facets'
|
14
14
|
end
|
15
15
|
|
16
16
|
task :full_test do
|
data/lib/utilrb/array/to_s.rb
CHANGED
data/lib/utilrb/common.rb
CHANGED
data/lib/utilrb/hash/to_s.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
class Queue
|
2
|
+
# Returns all elements currently in the queue.
|
3
|
+
# If +non_block+ is true, returns an empty array
|
4
|
+
# if the queue is empty
|
5
|
+
def get(non_block = false)
|
6
|
+
while (Thread.critical = true; @que.empty?)
|
7
|
+
return [] if non_block
|
8
|
+
@waiting.push Thread.current
|
9
|
+
Thread.stop
|
10
|
+
end
|
11
|
+
result = @que.dup
|
12
|
+
@que.clear
|
13
|
+
result
|
14
|
+
ensure
|
15
|
+
Thread.critical = false
|
16
|
+
end
|
17
|
+
end
|
data/lib/utilrb/queue.rb
ADDED
data/test/test_array.rb
CHANGED
data/test/test_gc.rb
CHANGED
@@ -4,11 +4,6 @@ require 'utilrb/gc'
|
|
4
4
|
require 'enumerator'
|
5
5
|
|
6
6
|
class TC_GC < Test::Unit::TestCase
|
7
|
-
def allocate(&block)
|
8
|
-
ObjectSpace.define_finalizer(Object.new, &block)
|
9
|
-
nil
|
10
|
-
end
|
11
|
-
|
12
7
|
def allocate(&block)
|
13
8
|
# Allocate twice since it seems the last object stays on stack
|
14
9
|
# (and is not GC'ed)
|
data/test/test_hash.rb
CHANGED
data/test/test_object.rb
CHANGED
@@ -59,7 +59,7 @@ class TC_Object < Test::Unit::TestCase
|
|
59
59
|
assert_equal(object, object.singleton_class.singleton_instance)
|
60
60
|
assert(object.has_singleton?)
|
61
61
|
assert_equal(klass, object.singleton_class.superclass)
|
62
|
-
assert_equal([object.singleton_class, klass, Object
|
62
|
+
assert_equal([object.singleton_class, klass, Object], object.singleton_class.ancestors[0, 3])
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: utilrb
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version:
|
7
|
-
date: 2006-
|
6
|
+
version: 0.2.2
|
7
|
+
date: 2006-12-01 00:00:00 +01:00
|
8
8
|
summary: Yet another Ruby toolkit
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -12,7 +12,7 @@ require_paths:
|
|
12
12
|
email: sylvain.joyeux@m4x.org
|
13
13
|
homepage: " http://utilrb.rubyforge.org"
|
14
14
|
rubyforge_project: utilrb
|
15
|
-
description: "
|
15
|
+
description: "== What is Utilrb ? Utilrb is yet another Ruby toolkit, in the spirit of facets. It includes all the standard class extensions I use in my own projects like Genom.rb. == Utilrb's C extension Utilrb includes a C extension in ext/. It is optional, but some of the functionalities will be disabled if it is not present. Trying to require a file in which there is a C-only feature will yield a warning on STDOUT. * some features have a Ruby version, but a C version is provided for performance: - Enumerable#each_uniq * some features are C-only - ValueSet class - Kernel#swap!"
|
16
16
|
autorequire:
|
17
17
|
default_executable:
|
18
18
|
bindir: bin
|
@@ -73,6 +73,8 @@ files:
|
|
73
73
|
- lib/utilrb/object.rb
|
74
74
|
- lib/utilrb/object/singleton_class.rb
|
75
75
|
- lib/utilrb/objectstats.rb
|
76
|
+
- lib/utilrb/queue/get.rb
|
77
|
+
- lib/utilrb/queue.rb
|
76
78
|
- lib/utilrb.rb
|
77
79
|
- lib/utilrb/time.rb
|
78
80
|
- lib/utilrb/time/to_hms.rb
|
@@ -117,6 +119,15 @@ extensions: []
|
|
117
119
|
requirements: []
|
118
120
|
|
119
121
|
dependencies:
|
122
|
+
- !ruby/object:Gem::Dependency
|
123
|
+
name: hoe
|
124
|
+
version_requirement:
|
125
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: 1.1.4
|
130
|
+
version:
|
120
131
|
- !ruby/object:Gem::Dependency
|
121
132
|
name: facets
|
122
133
|
version_requirement:
|