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 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
@@ -41,6 +41,8 @@ lib/utilrb/object/attribute.rb
41
41
  lib/utilrb/object.rb
42
42
  lib/utilrb/object/singleton_class.rb
43
43
  lib/utilrb/objectstats.rb
44
+ lib/utilrb/queue/get.rb
45
+ lib/utilrb/queue.rb
44
46
  lib/utilrb.rb
45
47
  lib/utilrb/time.rb
46
48
  lib/utilrb/time/to_hms.rb
data/README.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  Utilrb
2
2
  http://utilrb.rubyforge.org
3
- http://www.laas.fr/~sjoyeux/darcs/utilrb
3
+ http://www.laas.fr/~sjoyeux/darcs/utilrb (dev repository)
4
4
  http://www.laas.fr/~sjoyeux/research.php
5
5
 
6
6
  Copyright (c) 2006
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', 2..5).join("\n\n")
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 = ['facets']
13
+ p.extra_deps << 'facets'
14
14
  end
15
15
 
16
16
  task :full_test do
@@ -6,7 +6,7 @@ class Array
6
6
  else
7
7
  begin
8
8
  stack.push self
9
- map { |obj| obj.to_s }.join(", ")
9
+ "[" << map { |obj| obj.to_s }.join(", ") << "]"
10
10
  ensure
11
11
  stack.pop
12
12
  end
data/lib/utilrb/common.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Utilrb
2
- VERSION = "0.2" unless defined? Utilrb::VERSION
2
+ VERSION = "0.2.2" unless defined? Utilrb::VERSION
3
3
 
4
4
  unless defined? UTILRB_FASTER_MODE
5
5
  if ENV['UTILRB_FASTER_MODE'] == 'no'
@@ -1,6 +1,6 @@
1
1
  class Hash
2
2
  def to_s
3
- map { |k, v| "#{k} => #{v}" }.join(", ")
3
+ "{" << map { |k, v| "#{k} => #{v}" }.join(", ") << "}"
4
4
  end
5
5
  end
6
6
 
@@ -1,6 +1,6 @@
1
1
  class Module
2
2
  # Check if +klass+ is an ancestor of this class/module
3
- def has_ancestor?(klass); ancestors.find { |a| a == klass } end
3
+ def has_ancestor?(klass); self == klass || self < klass end
4
4
  end
5
5
 
6
6
 
@@ -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
@@ -0,0 +1,2 @@
1
+ require 'utilrb/kernel/require'
2
+ require_dir(__FILE__)
data/test/test_array.rb CHANGED
@@ -3,7 +3,7 @@ require 'utilrb/array'
3
3
 
4
4
  class TC_Array < Test::Unit::TestCase
5
5
  def test_to_s
6
- assert_equal("1, 2", [1, 2].to_s)
6
+ assert_equal("[1, 2]", [1, 2].to_s)
7
7
  end
8
8
  end
9
9
 
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
@@ -16,7 +16,7 @@ class TC_Hash < Test::Unit::TestCase
16
16
  end
17
17
 
18
18
  def test_to_s
19
- assert_equal("1 => 2, 2 => 3", { 1 => 2, 2 => 3 }.to_s)
19
+ assert_equal("{1 => 2, 2 => 3}", { 1 => 2, 2 => 3 }.to_s)
20
20
  end
21
21
  end
22
22
 
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, Kernel], object.singleton_class.ancestors)
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: "0.2"
7
- date: 2006-11-22 00:00:00 +01:00
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: "This work is licensed under the BSD license. See License.txt for details == 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"
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: