b 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +0 -2
- data/lib/b.rb +6 -8
- data/lib/b/version.rb +1 -1
- data/spec/b_spec.rb +15 -0
- metadata +24 -19
data/README.md
CHANGED
data/lib/b.rb
CHANGED
@@ -11,7 +11,9 @@ module B
|
|
11
11
|
def self.enchmark(id='Untitled Benchmark', opts={}, &block)
|
12
12
|
opts = {:output => ConsoleWriter.new}.merge(opts)
|
13
13
|
opts[:parent] = opts[:output]
|
14
|
-
|
14
|
+
em = Enchmark.new(id, opts)
|
15
|
+
Blockenspiel.invoke(block, em)
|
16
|
+
em.run!
|
15
17
|
end
|
16
18
|
|
17
19
|
# B::Ase
|
@@ -24,7 +26,7 @@ module B
|
|
24
26
|
def run!
|
25
27
|
@children.map {|c| c.run! unless c.nil?} unless @children.nil?
|
26
28
|
post_run if self.respond_to? :post_run
|
27
|
-
@children.map(&:to_h)
|
29
|
+
@children.nil? ? [] : @children.map(&:to_h)
|
28
30
|
end
|
29
31
|
|
30
32
|
def register(job)
|
@@ -70,12 +72,8 @@ module B
|
|
70
72
|
a.send(@compare) <=> b.send(@compare)
|
71
73
|
end
|
72
74
|
end
|
73
|
-
@buffer.
|
74
|
-
|
75
|
-
job.x = 1.0
|
76
|
-
else
|
77
|
-
job.x = job.send(@compare) / @buffer[0].send(@compare)
|
78
|
-
end
|
75
|
+
@buffer.each do |job|
|
76
|
+
job.x = job.send(@compare) / @buffer[0].send(@compare)
|
79
77
|
end
|
80
78
|
until @buffer.empty? do
|
81
79
|
@parent.start @buffer[0]
|
data/lib/b/version.rb
CHANGED
data/spec/b_spec.rb
CHANGED
@@ -42,6 +42,13 @@ describe B do
|
|
42
42
|
job('d', :rounds => 10) { d.call }
|
43
43
|
end
|
44
44
|
end
|
45
|
+
|
46
|
+
it 'tolerates any return value from the DSL block' do
|
47
|
+
a = mock(:a)
|
48
|
+
B.enchmark do
|
49
|
+
nil
|
50
|
+
end
|
51
|
+
end
|
45
52
|
end
|
46
53
|
|
47
54
|
describe "return value" do
|
@@ -59,6 +66,14 @@ describe B do
|
|
59
66
|
end
|
60
67
|
end
|
61
68
|
|
69
|
+
it 'is [] when no jobs are defined' do
|
70
|
+
a = mock(:a)
|
71
|
+
r = B.enchmark do
|
72
|
+
nil
|
73
|
+
end
|
74
|
+
r.should == []
|
75
|
+
end
|
76
|
+
|
62
77
|
it "retval[*][:x] is nil" do
|
63
78
|
results = B.enchmark do
|
64
79
|
job('a') {}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: b
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-06 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: simplecov
|
16
|
-
requirement: &
|
16
|
+
requirement: &19674780 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *19674780
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &19673740 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *19673740
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &19673280 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *19673280
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: guard
|
49
|
-
requirement: &
|
49
|
+
requirement: &19672860 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *19672860
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: guard-rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &19672320 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *19672320
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: stdiotrap
|
71
|
-
requirement: &
|
71
|
+
requirement: &19671480 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *19671480
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: hitimes
|
82
|
-
requirement: &
|
82
|
+
requirement: &19670780 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *19670780
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: blockenspiel
|
93
|
-
requirement: &
|
93
|
+
requirement: &19669680 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *19669680
|
102
102
|
description: A small, convenient benchmark-library.
|
103
103
|
email:
|
104
104
|
- moe@busyloop.net
|
@@ -132,12 +132,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
132
|
- - ! '>='
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: '0'
|
135
|
+
segments:
|
136
|
+
- 0
|
137
|
+
hash: 4128064067268145364
|
135
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
139
|
none: false
|
137
140
|
requirements:
|
138
141
|
- - ! '>='
|
139
142
|
- !ruby/object:Gem::Version
|
140
143
|
version: '0'
|
144
|
+
segments:
|
145
|
+
- 0
|
146
|
+
hash: 4128064067268145364
|
141
147
|
requirements: []
|
142
148
|
rubyforge_project:
|
143
149
|
rubygems_version: 1.8.10
|
@@ -147,4 +153,3 @@ summary: A small, convenient benchmark-library.
|
|
147
153
|
test_files:
|
148
154
|
- spec/b_spec.rb
|
149
155
|
- spec/spec_helper.rb
|
150
|
-
has_rdoc: false
|