sorted 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f0ad49531eb40c3d51bc2a4950f86b72ae83ea7
4
- data.tar.gz: 2e51b786f0cd6517b6ad3ae2f0fe51a7eb77d257
3
+ metadata.gz: 17571af478bc9338550f0550dfe618c02bebfed7
4
+ data.tar.gz: 5000ea79f79cdba6f8633c767f212492b5813c4a
5
5
  SHA512:
6
- metadata.gz: 0c1ac0dfd1f9364671961822558ab89f5363e8d5c39e6b3bdaf638eb2ad0d14dcd98205ebc7935650633e66955f582945fe08708d4085619bb9d7d775395b2bc
7
- data.tar.gz: f74792f358763f1b61df176cf900b4581659f53fd838adf98c60c2b0606f426581e2db94311665d33ef2d9484d153295e97a225ced3d1f21bf507581e5a9a1d4
6
+ metadata.gz: b17a5cc1d3d5bb9a56805f67cf5a67b90ad16bcc3c6dd08f5bf4986f70702bd5a3b3965dc77fd868dc619a58aa6f40abdc61eeb1b0028dfbd83aa07e58181b4b
7
+ data.tar.gz: b86b3af64d2cae38b0a3349b024d4611230cdea89f1d589995c0dcaab6374c1b19c2822ac743bf8b5f556d168b32b52264495ddfa8c378d9019572ed05c0918e
@@ -1,50 +1,39 @@
1
1
  # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2014-12-14 20:28:26 +1100 using RuboCop version 0.28.0.
2
+ # on 2015-03-01 13:05:10 +1100 using RuboCop version 0.28.0.
3
3
  # The point is for the user to remove these configuration records
4
4
  # one by one as the offenses are removed from the code base.
5
5
  # Note that changes in the inspected code, or installation of new
6
6
  # versions of RuboCop, may require this file to be generated again.
7
7
 
8
- # Offense count: 5
9
- Lint/UselessAssignment:
10
- Enabled: false
11
-
12
- # Offense count: 2
13
- Lint/Void:
14
- Enabled: false
15
-
16
- # Offense count: 2
8
+ # Offense count: 1
17
9
  Metrics/AbcSize:
18
- Max: 29
10
+ Max: 21
19
11
 
20
12
  # Offense count: 1
21
- Metrics/CyclomaticComplexity:
22
- Max: 8
13
+ # Configuration parameters: CountComments.
14
+ Metrics/ClassLength:
15
+ Max: 103
23
16
 
24
- # Offense count: 22
17
+ # Offense count: 12
25
18
  # Configuration parameters: AllowURI, URISchemes.
26
19
  Metrics/LineLength:
27
- Max: 177
20
+ Max: 131
28
21
 
29
- # Offense count: 2
22
+ # Offense count: 1
30
23
  # Configuration parameters: CountComments.
31
24
  Metrics/MethodLength:
32
- Max: 18
25
+ Max: 13
33
26
 
34
- # Offense count: 1
35
- Metrics/PerceivedComplexity:
36
- Max: 9
37
-
38
- # Offense count: 14
27
+ # Offense count: 8
39
28
  Style/Documentation:
40
29
  Enabled: false
41
30
 
42
- # Offense count: 5
31
+ # Offense count: 3
43
32
  # Configuration parameters: EnforcedStyle, SupportedStyles.
44
33
  Style/For:
45
34
  Enabled: false
46
35
 
47
- # Offense count: 1
36
+ # Offense count: 3
48
37
  # Configuration parameters: MaxLineLength.
49
38
  Style/IfUnlessModifier:
50
39
  Enabled: false
data/Rakefile CHANGED
@@ -31,11 +31,11 @@ task :benchmark do
31
31
  n = 50_000
32
32
  Benchmark.bm do |x|
33
33
  # Query
34
- x.report(:uri_parse) { for i in 1..n; Sorted::URIQuery.parse(uri); end }
35
- x.report(:sql_parse) { for i in 1..n; Sorted::SQLQuery.parse(sql); end }
34
+ x.report(:uri_parse) { for _ in 1..n; Sorted::URIQuery.parse(uri); end }
35
+ x.report(:sql_parse) { for _ in 1..n; Sorted::SQLQuery.parse(sql); end }
36
36
 
37
37
  # Set
38
- x.report(:direction_intersect) { for i in 1..n; sql_set.direction_intersect(uri_set); end }
38
+ x.report(:direction_intersect) { for _ in 1..n; sql_set.direction_intersect(uri_set); end }
39
39
  end
40
40
  end
41
41
 
@@ -55,8 +55,16 @@ module Sorted
55
55
  self.class.new(@set + other.to_a)
56
56
  end
57
57
 
58
- def <<(a)
59
- self.class.new(@set << a)
58
+ def <<(other)
59
+ self.class.new(@set << other.to_a)
60
+ end
61
+
62
+ def select(&block)
63
+ self.class.new(@set.select(&block))
64
+ end
65
+
66
+ def reject(&block)
67
+ self.class.new(@set.reject(&block))
60
68
  end
61
69
 
62
70
  def <=>(other)
@@ -1,3 +1,3 @@
1
1
  module Sorted
2
- VERSION = '2.0.1'
2
+ VERSION = '2.0.2'
3
3
  end
@@ -71,4 +71,16 @@ describe Sorted::Set do
71
71
 
72
72
  expect(set.to_hash).to eq(result)
73
73
  end
74
+
75
+ it 'should return set when selecting items' do
76
+ set = Sorted::Set.new([['email', 'asc']])
77
+
78
+ expect(set.select { true }.class).to eq(Sorted::Set)
79
+ end
80
+
81
+ it 'should return set when rejecting items' do
82
+ set = Sorted::Set.new([['email', 'asc']])
83
+
84
+ expect(set.reject { true }.class).to eq(Sorted::Set)
85
+ end
74
86
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorted
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rufus Post
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-05 00:00:00.000000000 Z
11
+ date: 2015-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake