dat-analysis 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/dat-analysis.gemspec +1 -1
- data/lib/dat/analysis.rb +7 -6
- data/test/dat_analysis_test.rb +10 -10
- metadata +11 -17
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8934b7381698c14681f2e9cc7d6d158528d7d79e
|
4
|
+
data.tar.gz: 69361f17512a7afa27e941949afb0ebf432bc22c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 94ba51bb3d704b03131291b9f1c46d8d6c86b05c5842dae27b52dae538b61a80d4f86da1e3f20e01db36367a0f7e12251aa4e8731313ac4b3bf56747c4915009
|
7
|
+
data.tar.gz: 2abf8dce31f8882ea0488695e9677364cc6dd696f7328f17a05b9665b7e7f1d57c0d360c45dafe62464ce514765ab02d24207804fae46e95ab3f6791baf98041
|
data/dat-analysis.gemspec
CHANGED
data/lib/dat/analysis.rb
CHANGED
@@ -95,11 +95,11 @@ module Dat
|
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
-
# Public: skip pending mismatch results
|
98
|
+
# Public: skip pending mismatch results satisfying the provided block.
|
99
99
|
# May modify current mismatch result.
|
100
100
|
#
|
101
101
|
# &block - block accepting a prepared mismatch result and returning true
|
102
|
-
#
|
102
|
+
# if the result should be skipped and false otherwise.
|
103
103
|
#
|
104
104
|
# Examples:
|
105
105
|
#
|
@@ -115,15 +115,16 @@ module Dat
|
|
115
115
|
# result['timestamp'].to_i > 1.hour.ago
|
116
116
|
# end
|
117
117
|
#
|
118
|
-
# Returns nil if
|
119
|
-
# Returns count of remaining results if a
|
120
|
-
# current result set to first result for
|
118
|
+
# Returns nil if all results are skipped. Current result will be nil.
|
119
|
+
# Returns count of remaining results if a result not matching the skip
|
120
|
+
# condition is found. Leaves current result set to first result for
|
121
|
+
# which block returns a falsey value.
|
121
122
|
def skip(&block)
|
122
123
|
raise ArgumentError, "a block is required" unless block_given?
|
123
124
|
|
124
125
|
while more?
|
125
126
|
fetch
|
126
|
-
return count
|
127
|
+
return count unless yield(current)
|
127
128
|
end
|
128
129
|
|
129
130
|
# clear current result since nothing of interest was found.
|
data/test/dat_analysis_test.rb
CHANGED
@@ -281,59 +281,59 @@ class DatAnalysisTest < MiniTest::Unit::TestCase
|
|
281
281
|
end
|
282
282
|
end
|
283
283
|
|
284
|
-
def
|
284
|
+
def test_skip_returns_0_if_the_current_result_does_not_satisfy_the_block_and_no_other_results_are_available
|
285
285
|
@analyzer.mismatches.push @result
|
286
286
|
|
287
287
|
remaining = @analyzer.skip do |result|
|
288
|
-
|
288
|
+
false
|
289
289
|
end
|
290
290
|
|
291
291
|
assert_equal 0, remaining
|
292
292
|
end
|
293
293
|
|
294
|
-
def
|
294
|
+
def test_skip_returns_the_number_of_additional_results_if_the_current_result_does_not_satisfy_the_block_and_other_results_are_available
|
295
295
|
@analyzer.mismatches.push @result
|
296
296
|
@analyzer.mismatches.push @result
|
297
297
|
@analyzer.mismatches.push @result
|
298
298
|
|
299
299
|
remaining = @analyzer.skip do |result|
|
300
|
-
|
300
|
+
false
|
301
301
|
end
|
302
302
|
|
303
303
|
assert_equal 2, remaining
|
304
304
|
end
|
305
305
|
|
306
|
-
def
|
306
|
+
def test_skip_returns_nil_if_all_results_are_satisfying
|
307
307
|
@analyzer.mismatches.push @result
|
308
308
|
@analyzer.mismatches.push @result
|
309
309
|
@analyzer.mismatches.push @result
|
310
310
|
|
311
311
|
remaining = @analyzer.skip do |result|
|
312
|
-
|
312
|
+
true
|
313
313
|
end
|
314
314
|
|
315
315
|
assert_nil remaining
|
316
316
|
end
|
317
317
|
|
318
|
-
def
|
318
|
+
def test_skip_skips_all_results_if_all_results_are_satisfying
|
319
319
|
@analyzer.mismatches.push @result
|
320
320
|
@analyzer.mismatches.push @result
|
321
321
|
@analyzer.mismatches.push @result
|
322
322
|
|
323
323
|
remaining = @analyzer.skip do |result|
|
324
|
-
|
324
|
+
true
|
325
325
|
end
|
326
326
|
|
327
327
|
assert !@analyzer.more?
|
328
328
|
end
|
329
329
|
|
330
|
-
def
|
330
|
+
def test_skip_leaves_current_as_nil_if_all_results_are_satisfying
|
331
331
|
@analyzer.mismatches.push @result
|
332
332
|
@analyzer.mismatches.push @result
|
333
333
|
@analyzer.mismatches.push @result
|
334
334
|
|
335
335
|
remaining = @analyzer.skip do |result|
|
336
|
-
|
336
|
+
true
|
337
337
|
end
|
338
338
|
|
339
339
|
assert_nil @analyzer.current
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dat-analysis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- John Barnette
|
@@ -10,38 +9,34 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2014-05-03 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: minitest
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - '>='
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: '0'
|
23
21
|
type: :development
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - '>='
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: '0'
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: mocha
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- -
|
32
|
+
- - '>='
|
37
33
|
- !ruby/object:Gem::Version
|
38
34
|
version: '0'
|
39
35
|
type: :development
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- -
|
39
|
+
- - '>='
|
45
40
|
- !ruby/object:Gem::Version
|
46
41
|
version: '0'
|
47
42
|
description: Analyze results from dat-science
|
@@ -85,27 +80,26 @@ files:
|
|
85
80
|
- test/fixtures/invalid-matcher/matcher.rb
|
86
81
|
homepage: https://github.com/github/dat-analysis
|
87
82
|
licenses: []
|
83
|
+
metadata: {}
|
88
84
|
post_install_message:
|
89
85
|
rdoc_options: []
|
90
86
|
require_paths:
|
91
87
|
- lib
|
92
88
|
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
-
none: false
|
94
89
|
requirements:
|
95
|
-
- -
|
90
|
+
- - '>='
|
96
91
|
- !ruby/object:Gem::Version
|
97
92
|
version: '0'
|
98
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
94
|
requirements:
|
101
|
-
- -
|
95
|
+
- - '>='
|
102
96
|
- !ruby/object:Gem::Version
|
103
97
|
version: '0'
|
104
98
|
requirements: []
|
105
99
|
rubyforge_project:
|
106
|
-
rubygems_version:
|
100
|
+
rubygems_version: 2.0.3
|
107
101
|
signing_key:
|
108
|
-
specification_version:
|
102
|
+
specification_version: 4
|
109
103
|
summary: HYPOTHESIZE THIS.
|
110
104
|
test_files:
|
111
105
|
- test/dat_analysis_subclassing_test.rb
|