activeset 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/CHANGELOG +5 -0
- data/Gemfile.lock +190 -0
- data/activeset.gemspec +2 -2
- data/lib/helpers/transform_to_sortable_numeric.rb +18 -9
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 111dce72262ab724e87284ae53db551f64f7fbd3
|
4
|
+
data.tar.gz: 1b27b096fff28fd454031b867e37e5fa330eca9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db987bc554e79ea8153205f488ee9b7a66e1c46eb1e5a7d6ba3a047a681fdb3d7e8251d9bb7a1e67bab29b29fb65036fc6e8e20280d8499432f026d45c34cb42
|
7
|
+
data.tar.gz: 3a00cead112dc0a94b2b588ecaece1bbea28936cbd4e5383d5902a36bc4a05cacad6ca22181af02af8d56a700a585983203545d513220433db0d5140b354715c
|
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
v 0.8.4
|
2
|
+
- start using Bundler v2.x
|
3
|
+
- check the Gemfile.lock into version control
|
4
|
+
- handle transforming Date objects into sortable integers a bit more intelligently to ensure UTC
|
5
|
+
- fix Rubocop offenses (safely)
|
1
6
|
v 0.8.3
|
2
7
|
- fix a bug to allow sorting of computed attributes on sets that include nil values
|
3
8
|
v 0.8.2
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
activeset (0.8.3)
|
5
|
+
activesupport (>= 4.0.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actioncable (5.1.6)
|
11
|
+
actionpack (= 5.1.6)
|
12
|
+
nio4r (~> 2.0)
|
13
|
+
websocket-driver (~> 0.6.1)
|
14
|
+
actionmailer (5.1.6)
|
15
|
+
actionpack (= 5.1.6)
|
16
|
+
actionview (= 5.1.6)
|
17
|
+
activejob (= 5.1.6)
|
18
|
+
mail (~> 2.5, >= 2.5.4)
|
19
|
+
rails-dom-testing (~> 2.0)
|
20
|
+
actionpack (5.1.6)
|
21
|
+
actionview (= 5.1.6)
|
22
|
+
activesupport (= 5.1.6)
|
23
|
+
rack (~> 2.0)
|
24
|
+
rack-test (>= 0.6.3)
|
25
|
+
rails-dom-testing (~> 2.0)
|
26
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
27
|
+
actionview (5.1.6)
|
28
|
+
activesupport (= 5.1.6)
|
29
|
+
builder (~> 3.1)
|
30
|
+
erubi (~> 1.4)
|
31
|
+
rails-dom-testing (~> 2.0)
|
32
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
33
|
+
activejob (5.1.6)
|
34
|
+
activesupport (= 5.1.6)
|
35
|
+
globalid (>= 0.3.6)
|
36
|
+
activemodel (5.1.6)
|
37
|
+
activesupport (= 5.1.6)
|
38
|
+
activerecord (5.1.6)
|
39
|
+
activemodel (= 5.1.6)
|
40
|
+
activesupport (= 5.1.6)
|
41
|
+
arel (~> 8.0)
|
42
|
+
activesupport (5.1.6)
|
43
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
44
|
+
i18n (>= 0.7, < 2)
|
45
|
+
minitest (~> 5.1)
|
46
|
+
tzinfo (~> 1.1)
|
47
|
+
ansi (1.5.0)
|
48
|
+
arel (8.0.0)
|
49
|
+
ast (2.4.0)
|
50
|
+
builder (3.2.3)
|
51
|
+
codecov (0.1.13)
|
52
|
+
json
|
53
|
+
simplecov
|
54
|
+
url
|
55
|
+
combustion (0.7.0)
|
56
|
+
activesupport (>= 3.0.0)
|
57
|
+
railties (>= 3.0.0)
|
58
|
+
thor (>= 0.14.6)
|
59
|
+
concurrent-ruby (1.0.5)
|
60
|
+
crass (1.0.4)
|
61
|
+
database_cleaner (1.6.2)
|
62
|
+
diff-lcs (1.3)
|
63
|
+
docile (1.1.5)
|
64
|
+
erubi (1.7.1)
|
65
|
+
factory_bot (4.8.2)
|
66
|
+
activesupport (>= 3.0.0)
|
67
|
+
faker (1.8.7)
|
68
|
+
i18n (>= 0.7)
|
69
|
+
globalid (0.4.1)
|
70
|
+
activesupport (>= 4.2.0)
|
71
|
+
hirb (0.7.3)
|
72
|
+
i18n (1.1.1)
|
73
|
+
concurrent-ruby (~> 1.0)
|
74
|
+
jaro_winkler (1.5.1)
|
75
|
+
json (2.1.0)
|
76
|
+
loofah (2.2.3)
|
77
|
+
crass (~> 1.0.2)
|
78
|
+
nokogiri (>= 1.5.9)
|
79
|
+
mail (2.7.1)
|
80
|
+
mini_mime (>= 0.1.1)
|
81
|
+
method_source (0.9.0)
|
82
|
+
mini_mime (1.0.1)
|
83
|
+
mini_portile2 (2.3.0)
|
84
|
+
minitest (5.11.3)
|
85
|
+
nio4r (2.3.1)
|
86
|
+
nokogiri (1.8.5)
|
87
|
+
mini_portile2 (~> 2.3.0)
|
88
|
+
parallel (1.12.1)
|
89
|
+
parser (2.5.3.0)
|
90
|
+
ast (~> 2.4.0)
|
91
|
+
powerpack (0.1.2)
|
92
|
+
rack (2.0.5)
|
93
|
+
rack-test (1.1.0)
|
94
|
+
rack (>= 1.0, < 3)
|
95
|
+
rails (5.1.6)
|
96
|
+
actioncable (= 5.1.6)
|
97
|
+
actionmailer (= 5.1.6)
|
98
|
+
actionpack (= 5.1.6)
|
99
|
+
actionview (= 5.1.6)
|
100
|
+
activejob (= 5.1.6)
|
101
|
+
activemodel (= 5.1.6)
|
102
|
+
activerecord (= 5.1.6)
|
103
|
+
activesupport (= 5.1.6)
|
104
|
+
bundler (>= 1.3.0)
|
105
|
+
railties (= 5.1.6)
|
106
|
+
sprockets-rails (>= 2.0.0)
|
107
|
+
rails-dom-testing (2.0.3)
|
108
|
+
activesupport (>= 4.2.0)
|
109
|
+
nokogiri (>= 1.6)
|
110
|
+
rails-html-sanitizer (1.0.4)
|
111
|
+
loofah (~> 2.2, >= 2.2.2)
|
112
|
+
railties (5.1.6)
|
113
|
+
actionpack (= 5.1.6)
|
114
|
+
activesupport (= 5.1.6)
|
115
|
+
method_source
|
116
|
+
rake (>= 0.8.7)
|
117
|
+
thor (>= 0.18.1, < 2.0)
|
118
|
+
rainbow (3.0.0)
|
119
|
+
rake (10.5.0)
|
120
|
+
rspec (3.8.0)
|
121
|
+
rspec-core (~> 3.8.0)
|
122
|
+
rspec-expectations (~> 3.8.0)
|
123
|
+
rspec-mocks (~> 3.8.0)
|
124
|
+
rspec-core (3.8.0)
|
125
|
+
rspec-support (~> 3.8.0)
|
126
|
+
rspec-expectations (3.8.2)
|
127
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
128
|
+
rspec-support (~> 3.8.0)
|
129
|
+
rspec-mocks (3.8.0)
|
130
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
131
|
+
rspec-support (~> 3.8.0)
|
132
|
+
rspec-support (3.8.0)
|
133
|
+
rubocop (0.60.0)
|
134
|
+
jaro_winkler (~> 1.5.1)
|
135
|
+
parallel (~> 1.10)
|
136
|
+
parser (>= 2.5, != 2.5.1.1)
|
137
|
+
powerpack (~> 0.1)
|
138
|
+
rainbow (>= 2.2.2, < 4.0)
|
139
|
+
ruby-progressbar (~> 1.7)
|
140
|
+
unicode-display_width (~> 1.4.0)
|
141
|
+
ruby-progressbar (1.10.0)
|
142
|
+
simplecov (0.15.1)
|
143
|
+
docile (~> 1.1.0)
|
144
|
+
json (>= 1.8, < 3)
|
145
|
+
simplecov-html (~> 0.10.0)
|
146
|
+
simplecov-console (0.4.2)
|
147
|
+
ansi
|
148
|
+
hirb
|
149
|
+
simplecov
|
150
|
+
simplecov-html (0.10.2)
|
151
|
+
sprockets (3.7.2)
|
152
|
+
concurrent-ruby (~> 1.0)
|
153
|
+
rack (> 1, < 3)
|
154
|
+
sprockets-rails (3.2.1)
|
155
|
+
actionpack (>= 4.0)
|
156
|
+
activesupport (>= 4.0)
|
157
|
+
sprockets (>= 3.0.0)
|
158
|
+
sqlite3 (1.3.13)
|
159
|
+
thor (0.20.0)
|
160
|
+
thread_safe (0.3.6)
|
161
|
+
tzinfo (1.2.5)
|
162
|
+
thread_safe (~> 0.1)
|
163
|
+
unicode-display_width (1.4.0)
|
164
|
+
url (0.3.2)
|
165
|
+
websocket-driver (0.6.5)
|
166
|
+
websocket-extensions (>= 0.1.0)
|
167
|
+
websocket-extensions (0.1.3)
|
168
|
+
|
169
|
+
PLATFORMS
|
170
|
+
ruby
|
171
|
+
|
172
|
+
DEPENDENCIES
|
173
|
+
activerecord
|
174
|
+
activeset!
|
175
|
+
bundler (~> 2.0)
|
176
|
+
codecov
|
177
|
+
combustion (~> 0.7.0)
|
178
|
+
database_cleaner (~> 1.6.1)
|
179
|
+
factory_bot (~> 4.8.0)
|
180
|
+
faker (~> 1.8.4)
|
181
|
+
rails (~> 5.1.0)
|
182
|
+
rake (~> 10.0)
|
183
|
+
rspec (~> 3.0)
|
184
|
+
rubocop
|
185
|
+
simplecov (~> 0.15.0)
|
186
|
+
simplecov-console (~> 0.4.2)
|
187
|
+
sqlite3
|
188
|
+
|
189
|
+
BUNDLED WITH
|
190
|
+
2.0.1
|
data/activeset.gemspec
CHANGED
@@ -6,7 +6,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.name = 'activeset'
|
9
|
-
spec.version = '0.8.
|
9
|
+
spec.version = '0.8.4'
|
10
10
|
spec.authors = ['Stephen Margheim']
|
11
11
|
spec.email = ['stephen.margheim@gmail.com']
|
12
12
|
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.add_dependency 'activesupport', '>= 4.0.2'
|
26
26
|
|
27
|
-
spec.add_development_dependency 'bundler', '~>
|
27
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
28
28
|
spec.add_development_dependency 'codecov'
|
29
29
|
spec.add_development_dependency 'combustion', '~> 0.7.0'
|
30
30
|
spec.add_development_dependency 'database_cleaner', '~> 1.6.1'
|
@@ -24,16 +24,11 @@ def transform_to_sortable_numeric(value)
|
|
24
24
|
elsif key == false
|
25
25
|
0
|
26
26
|
elsif key.is_a?(String) || key.is_a?(Symbol)
|
27
|
-
key
|
28
|
-
|
29
|
-
|
30
|
-
.map { |char| char.ord.to_s.rjust(3, '0') } # ["097", "066", "048", "057", "252"]
|
31
|
-
.insert(1, '.') # ["097", ".", "066", "048", "057", "252"]
|
32
|
-
.reduce(&:concat) # "097.066048057252"
|
33
|
-
.to_r # (24266512014313/250000000000)
|
27
|
+
string_to_sortable_numeric(key.to_s)
|
28
|
+
elsif key.is_a?(Date)
|
29
|
+
time_to_sortable_numeric(Time.new(key.year, key.month, key.day, 0o0, 0o0, 0o0, 0))
|
34
30
|
elsif key.respond_to?(:to_time)
|
35
|
-
|
36
|
-
(key.to_time.to_f * 1000).round
|
31
|
+
time_to_sortable_numeric(key.to_time)
|
37
32
|
else
|
38
33
|
key
|
39
34
|
end
|
@@ -42,3 +37,17 @@ def transform_to_sortable_numeric(value)
|
|
42
37
|
end
|
43
38
|
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
44
39
|
# rubocop:enable Style/AsciiComments
|
40
|
+
|
41
|
+
def string_to_sortable_numeric(string)
|
42
|
+
string # 'aB09ü'
|
43
|
+
.split('') # ["a", "B", "0", "9", "ü"]
|
44
|
+
.map { |char| char.ord.to_s.rjust(3, '0') } # ["097", "066", "048", "057", "252"]
|
45
|
+
.insert(1, '.') # ["097", ".", "066", "048", "057", "252"]
|
46
|
+
.reduce(&:concat) # "097.066048057252"
|
47
|
+
.to_r # (24266512014313/250000000000)
|
48
|
+
end
|
49
|
+
|
50
|
+
def time_to_sortable_numeric(time)
|
51
|
+
# https://stackoverflow.com/a/30604935/2884386
|
52
|
+
(time.utc.to_f * 1000).round
|
53
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeset
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Margheim
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: codecov
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -207,6 +207,7 @@ files:
|
|
207
207
|
- ".travis.yml"
|
208
208
|
- CHANGELOG
|
209
209
|
- Gemfile
|
210
|
+
- Gemfile.lock
|
210
211
|
- LICENSE.txt
|
211
212
|
- README.md
|
212
213
|
- Rakefile
|