greenbar 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/greenbar/RandSetup.rb +6 -11
- data/rakefile.rb +1 -1
- metadata +2 -2
data/lib/greenbar/RandSetup.rb
CHANGED
@@ -40,22 +40,17 @@ module Greenbar::RandSetup
|
|
40
40
|
#:stopdoc:
|
41
41
|
include Greenbar::TestSetup
|
42
42
|
|
43
|
-
|
43
|
+
RAND_SEQUENCES = {}
|
44
44
|
|
45
45
|
def setup_mixin
|
46
|
-
Kernel.instance_eval {
|
47
|
-
rand_sequences = Greenbar::RandSetup.instance_eval { class_variable_get :@@rand_sequences }
|
48
|
-
class_variable_set :@@rand_sequences, rand_sequences
|
49
|
-
}
|
50
|
-
|
51
46
|
Kernel.class_eval do
|
52
47
|
|
53
48
|
alias :rand_saved_by_RandSetup :rand
|
54
49
|
|
55
50
|
def rand(max=0)
|
56
|
-
raise "Must use seed_rand_sequence(#{max}) before using rand(#{max})." unless
|
57
|
-
|
58
|
-
|
51
|
+
raise "Must use seed_rand_sequence(#{max}) before using rand(#{max})." unless RAND_SEQUENCES.has_key? max
|
52
|
+
RAND_SEQUENCES[max] << RAND_SEQUENCES[max].shift
|
53
|
+
RAND_SEQUENCES[max][-1]
|
59
54
|
end
|
60
55
|
end
|
61
56
|
end
|
@@ -64,7 +59,7 @@ module Greenbar::RandSetup
|
|
64
59
|
Kernel.class_eval do
|
65
60
|
alias :rand :rand_saved_by_RandSetup
|
66
61
|
remove_method :rand_saved_by_RandSetup
|
67
|
-
|
62
|
+
RAND_SEQUENCES.clear
|
68
63
|
end
|
69
64
|
end
|
70
65
|
#:startdoc:#
|
@@ -76,7 +71,7 @@ module Greenbar::RandSetup
|
|
76
71
|
def seed_rand_sequence(max, sequence)
|
77
72
|
array = sequence.to_a
|
78
73
|
raise "Must provide a non-empty sequence." if array.empty?
|
79
|
-
|
74
|
+
RAND_SEQUENCES[max] = array
|
80
75
|
end
|
81
76
|
|
82
77
|
end
|
data/rakefile.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: greenbar
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2006-
|
6
|
+
version: 1.0.1
|
7
|
+
date: 2006-07-16 00:00:00 -04:00
|
8
8
|
summary: Test::Unit tools.
|
9
9
|
require_paths:
|
10
10
|
- lib
|