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 +4 -4
- data/.rubocop_todo.yml +13 -24
- data/Rakefile +3 -3
- data/lib/sorted.rb +10 -2
- data/lib/sorted/version.rb +1 -1
- data/spec/set_spec.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17571af478bc9338550f0550dfe618c02bebfed7
|
4
|
+
data.tar.gz: 5000ea79f79cdba6f8633c767f212492b5813c4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b17a5cc1d3d5bb9a56805f67cf5a67b90ad16bcc3c6dd08f5bf4986f70702bd5a3b3965dc77fd868dc619a58aa6f40abdc61eeb1b0028dfbd83aa07e58181b4b
|
7
|
+
data.tar.gz: b86b3af64d2cae38b0a3349b024d4611230cdea89f1d589995c0dcaab6374c1b19c2822ac743bf8b5f556d168b32b52264495ddfa8c378d9019572ed05c0918e
|
data/.rubocop_todo.yml
CHANGED
@@ -1,50 +1,39 @@
|
|
1
1
|
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
-
# on
|
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:
|
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:
|
10
|
+
Max: 21
|
19
11
|
|
20
12
|
# Offense count: 1
|
21
|
-
|
22
|
-
|
13
|
+
# Configuration parameters: CountComments.
|
14
|
+
Metrics/ClassLength:
|
15
|
+
Max: 103
|
23
16
|
|
24
|
-
# Offense count:
|
17
|
+
# Offense count: 12
|
25
18
|
# Configuration parameters: AllowURI, URISchemes.
|
26
19
|
Metrics/LineLength:
|
27
|
-
Max:
|
20
|
+
Max: 131
|
28
21
|
|
29
|
-
# Offense count:
|
22
|
+
# Offense count: 1
|
30
23
|
# Configuration parameters: CountComments.
|
31
24
|
Metrics/MethodLength:
|
32
|
-
Max:
|
25
|
+
Max: 13
|
33
26
|
|
34
|
-
# Offense count:
|
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:
|
31
|
+
# Offense count: 3
|
43
32
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
44
33
|
Style/For:
|
45
34
|
Enabled: false
|
46
35
|
|
47
|
-
# Offense count:
|
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
|
35
|
-
x.report(:sql_parse) { for
|
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
|
38
|
+
x.report(:direction_intersect) { for _ in 1..n; sql_set.direction_intersect(uri_set); end }
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
data/lib/sorted.rb
CHANGED
@@ -55,8 +55,16 @@ module Sorted
|
|
55
55
|
self.class.new(@set + other.to_a)
|
56
56
|
end
|
57
57
|
|
58
|
-
def <<(
|
59
|
-
self.class.new(@set <<
|
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)
|
data/lib/sorted/version.rb
CHANGED
data/spec/set_spec.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2015-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|