ta_by_star 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +59 -0
- data/Gemfile +18 -0
- data/MIT-LICENSE +20 -0
- data/README.md +616 -0
- data/Rakefile +18 -0
- data/UPGRADING +4 -0
- data/by_star.gemspec +34 -0
- data/cleaner.rb +25 -0
- data/lib/by_star/base.rb +76 -0
- data/lib/by_star/between.rb +190 -0
- data/lib/by_star/directional.rb +35 -0
- data/lib/by_star/kernel/date.rb +41 -0
- data/lib/by_star/kernel/in_time_zone.rb +20 -0
- data/lib/by_star/kernel/time.rb +41 -0
- data/lib/by_star/normalization.rb +156 -0
- data/lib/by_star/orm/active_record/by_star.rb +75 -0
- data/lib/by_star/orm/mongoid/by_star.rb +90 -0
- data/lib/by_star/orm/mongoid/reorder.rb +23 -0
- data/lib/by_star/version.rb +3 -0
- data/lib/by_star.rb +18 -0
- data/spec/database.yml +15 -0
- data/spec/fixtures/active_record/models.rb +12 -0
- data/spec/fixtures/active_record/schema.rb +19 -0
- data/spec/fixtures/mongoid/models.rb +31 -0
- data/spec/fixtures/shared/seeds.rb +36 -0
- data/spec/gemfiles/Gemfile.rails +5 -0
- data/spec/gemfiles/Gemfile.rails32 +7 -0
- data/spec/gemfiles/Gemfile.rails40 +7 -0
- data/spec/gemfiles/Gemfile.rails41 +7 -0
- data/spec/gemfiles/Gemfile.rails42 +7 -0
- data/spec/gemfiles/Gemfile.rails50 +7 -0
- data/spec/gemfiles/Gemfile.rails51 +7 -0
- data/spec/gemfiles/Gemfile.rails52 +7 -0
- data/spec/gemfiles/Gemfile.rails60 +7 -0
- data/spec/gemfiles/Gemfile.rails61 +7 -0
- data/spec/integration/active_record/active_record_spec.rb +41 -0
- data/spec/integration/mongoid/mongoid_spec.rb +39 -0
- data/spec/integration/shared/at_time.rb +53 -0
- data/spec/integration/shared/between_dates.rb +99 -0
- data/spec/integration/shared/between_times.rb +99 -0
- data/spec/integration/shared/by_calendar_month.rb +55 -0
- data/spec/integration/shared/by_cweek.rb +54 -0
- data/spec/integration/shared/by_day.rb +120 -0
- data/spec/integration/shared/by_direction.rb +126 -0
- data/spec/integration/shared/by_fortnight.rb +48 -0
- data/spec/integration/shared/by_month.rb +50 -0
- data/spec/integration/shared/by_quarter.rb +49 -0
- data/spec/integration/shared/by_week.rb +54 -0
- data/spec/integration/shared/by_weekend.rb +49 -0
- data/spec/integration/shared/by_year.rb +48 -0
- data/spec/integration/shared/index_scope_parameter.rb +111 -0
- data/spec/integration/shared/offset_parameter.rb +32 -0
- data/spec/integration/shared/order_parameter.rb +36 -0
- data/spec/integration/shared/relative.rb +174 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/unit/kernel_date_spec.rb +113 -0
- data/spec/unit/kernel_time_spec.rb +57 -0
- data/spec/unit/normalization_spec.rb +384 -0
- data/tmp/.gitignore +1 -0
- metadata +298 -0
@@ -0,0 +1,384 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ByStar::Normalization do
|
4
|
+
|
5
|
+
let(:options){ {} }
|
6
|
+
|
7
|
+
shared_examples_for 'date normalization from string' do
|
8
|
+
|
9
|
+
context 'when Chronic is defined' do
|
10
|
+
|
11
|
+
context 'date String' do
|
12
|
+
let(:input){ '2014-01-01' }
|
13
|
+
it { should eq Date.parse('2014-01-01') }
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'time String' do
|
17
|
+
let(:input){ '2014-01-01 15:00:00' }
|
18
|
+
it { should eq Date.parse('2014-01-01') }
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'natural language String' do
|
22
|
+
let(:input){ 'tomorrow at 3:30 pm' }
|
23
|
+
it { should eq Date.parse('2014-01-02') }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'when Chronic is not defined' do
|
28
|
+
|
29
|
+
before { hide_const('Chronic') }
|
30
|
+
|
31
|
+
context 'date String' do
|
32
|
+
let(:input){ '2014-01-01' }
|
33
|
+
it { should eq Date.parse('2014-01-01') }
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'time String' do
|
37
|
+
let(:input){ '2014-01-01 15:00:00' }
|
38
|
+
it { should eq Date.parse('2014-01-01') }
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'natural language String' do
|
42
|
+
let(:input){ 'tomorrow at noon' }
|
43
|
+
it { expect{ subject }.to raise_error(ByStar::ParseError, "Cannot parse String #{input.inspect}") }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
shared_examples_for 'date normalization from time value' do
|
49
|
+
context 'Date' do
|
50
|
+
let(:input){ Date.parse('2014-01-01') }
|
51
|
+
it { expect eq Date.parse('2014-01-01') }
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'DateTime' do
|
55
|
+
let(:input){ Date.parse('2014-01-01').to_datetime }
|
56
|
+
it { expect eq Date.parse('2014-01-01') }
|
57
|
+
end
|
58
|
+
|
59
|
+
context 'Time' do
|
60
|
+
let(:input){ Date.parse('2014-01-01') }
|
61
|
+
it { expect eq Date.parse('2014-01-01') }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe '#time' do
|
66
|
+
subject { ByStar::Normalization.time(input) }
|
67
|
+
|
68
|
+
context 'when Chronic is defined' do
|
69
|
+
|
70
|
+
context 'date String' do
|
71
|
+
let(:input){ '2014-01-01' }
|
72
|
+
it { should eq Time.zone.parse('2014-01-01 12:00:00') }
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'time String' do
|
76
|
+
let(:input){ '2014-01-01 15:00:00' }
|
77
|
+
it { should eq Time.zone.parse('2014-01-01 15:00:00') }
|
78
|
+
end
|
79
|
+
|
80
|
+
context 'natural language String' do
|
81
|
+
let(:input){ 'tomorrow at 3:30 pm' }
|
82
|
+
it { should eq Time.zone.parse('2014-01-02 15:30:00') }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context 'when Chronic is not defined' do
|
87
|
+
|
88
|
+
before { hide_const('Chronic') }
|
89
|
+
|
90
|
+
context 'date String' do
|
91
|
+
let(:input){ '2014-01-01' }
|
92
|
+
it { should eq Time.zone.parse('2014-01-01 00:00:00') }
|
93
|
+
end
|
94
|
+
|
95
|
+
context 'time String' do
|
96
|
+
let(:input){ '2014-01-01 15:00:00' }
|
97
|
+
it { should eq Time.zone.parse('2014-01-01 15:00:00') }
|
98
|
+
end
|
99
|
+
|
100
|
+
context 'natural language String' do
|
101
|
+
let(:input){ 'tomorrow at noon' }
|
102
|
+
it { expect{ subject }.to raise_error(ByStar::ParseError, "Cannot parse String #{input.inspect}") }
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
context 'Date' do
|
107
|
+
let(:input){ Date.parse('2014-01-01') }
|
108
|
+
it { expect eq Time.zone.parse('2014-01-01 00:00:00') }
|
109
|
+
end
|
110
|
+
|
111
|
+
context 'DateTime' do
|
112
|
+
let(:input){ Time.zone.parse('2014-01-01 15:00:00').to_datetime }
|
113
|
+
it { expect eq Time.zone.parse('2014-01-01 15:00:00') }
|
114
|
+
end
|
115
|
+
|
116
|
+
context 'Time' do
|
117
|
+
let(:input){ Time.zone.parse('2014-01-01 15:00:00') }
|
118
|
+
it { expect eq Time.zone.parse('2014-01-01 15:00:00') }
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
describe '#week' do
|
123
|
+
subject { ByStar::Normalization.week(input, options) }
|
124
|
+
it_behaves_like 'date normalization from string'
|
125
|
+
it_behaves_like 'date normalization from time value'
|
126
|
+
|
127
|
+
context 'Integer -1' do
|
128
|
+
let(:input){ -1 }
|
129
|
+
it { expect{subject}.to raise_error(ByStar::ParseError, 'Week number must be between 0 and 52') }
|
130
|
+
end
|
131
|
+
|
132
|
+
context 'Integer 0' do
|
133
|
+
let(:input){ 0 }
|
134
|
+
it { expect eq Date.parse('2014-01-01') }
|
135
|
+
end
|
136
|
+
|
137
|
+
context 'Integer 20' do
|
138
|
+
let(:input){ 20 }
|
139
|
+
it { expect eq Date.parse('2014-05-21') }
|
140
|
+
end
|
141
|
+
|
142
|
+
context 'Integer 53' do
|
143
|
+
let(:input){ 53 }
|
144
|
+
it { expect{subject}.to raise_error(ByStar::ParseError, 'Week number must be between 0 and 52') }
|
145
|
+
end
|
146
|
+
|
147
|
+
context 'with year option' do
|
148
|
+
let(:options){ { year: 2011 } }
|
149
|
+
|
150
|
+
context 'Integer 0' do
|
151
|
+
let(:input){ 0 }
|
152
|
+
it { expect eq Date.parse('2011-01-01') }
|
153
|
+
end
|
154
|
+
|
155
|
+
context 'Integer 20' do
|
156
|
+
let(:input){ 20 }
|
157
|
+
it { expect eq Date.parse('2011-05-21') }
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
describe '#cweek' do
|
163
|
+
subject { ByStar::Normalization.cweek(input, options) }
|
164
|
+
it_behaves_like 'date normalization from string'
|
165
|
+
it_behaves_like 'date normalization from time value'
|
166
|
+
|
167
|
+
context 'Integer 9' do
|
168
|
+
let(:input){ 0 }
|
169
|
+
it { expect{subject}.to raise_error(ByStar::ParseError, 'cweek number must be between 1 and 53') }
|
170
|
+
end
|
171
|
+
|
172
|
+
context 'Integer 1' do
|
173
|
+
let(:input){ 1 }
|
174
|
+
it { expect eq Date.parse('2014-01-01') }
|
175
|
+
end
|
176
|
+
|
177
|
+
context 'Integer 21' do
|
178
|
+
let(:input){ 21 }
|
179
|
+
it { expect eq Date.parse('2014-05-21') }
|
180
|
+
end
|
181
|
+
|
182
|
+
context 'Integer 54' do
|
183
|
+
let(:input){ 54 }
|
184
|
+
it { expect{subject}.to raise_error(ByStar::ParseError, 'cweek number must be between 1 and 53') }
|
185
|
+
end
|
186
|
+
|
187
|
+
context 'with year option' do
|
188
|
+
let(:options){ { year: 2011 } }
|
189
|
+
|
190
|
+
context 'Integer 1' do
|
191
|
+
let(:input){ 1 }
|
192
|
+
it { expect eq Date.parse('2011-01-01') }
|
193
|
+
end
|
194
|
+
|
195
|
+
context 'Integer 21' do
|
196
|
+
let(:input){ 21 }
|
197
|
+
it { expect eq Date.parse('2011-05-21') }
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
describe '#fortnight' do
|
203
|
+
subject { ByStar::Normalization.fortnight(input, options) }
|
204
|
+
it_behaves_like 'date normalization from string'
|
205
|
+
it_behaves_like 'date normalization from time value'
|
206
|
+
|
207
|
+
context 'Integer 0' do
|
208
|
+
let(:input){ 0 }
|
209
|
+
it { expect eq Date.parse('2014-01-01') }
|
210
|
+
end
|
211
|
+
|
212
|
+
context 'Integer 26' do
|
213
|
+
let(:input){ 26 }
|
214
|
+
it { expect eq Date.parse('2014-12-31') }
|
215
|
+
end
|
216
|
+
|
217
|
+
context 'out of range' do
|
218
|
+
specify { expect{ ByStar::Normalization.fortnight(-1) }.to raise_error(ByStar::ParseError, 'Fortnight number must be between 0 and 26') }
|
219
|
+
specify { expect{ ByStar::Normalization.fortnight(27) }.to raise_error(ByStar::ParseError, 'Fortnight number must be between 0 and 26') }
|
220
|
+
end
|
221
|
+
|
222
|
+
context 'with year option' do
|
223
|
+
let(:options){ { year: 2011 } }
|
224
|
+
|
225
|
+
context 'Integer 0' do
|
226
|
+
let(:input){ 0 }
|
227
|
+
it { expect eq Date.parse('2011-01-01') }
|
228
|
+
end
|
229
|
+
|
230
|
+
context 'Integer 26' do
|
231
|
+
let(:input){ 26 }
|
232
|
+
it { expect eq Date.parse('2011-12-31') }
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
describe '#month' do
|
238
|
+
subject { ByStar::Normalization.month(input, options) }
|
239
|
+
it_behaves_like 'date normalization from time value'
|
240
|
+
|
241
|
+
context 'month abbr String' do
|
242
|
+
let(:input){ 'Feb' }
|
243
|
+
it { expect eq Date.parse('2014-02-01') }
|
244
|
+
end
|
245
|
+
|
246
|
+
context 'month full String' do
|
247
|
+
let(:input){ 'February' }
|
248
|
+
it { expect eq Date.parse('2014-02-01') }
|
249
|
+
end
|
250
|
+
|
251
|
+
context 'number String' do
|
252
|
+
let(:input){ '2' }
|
253
|
+
it { expect eq Date.parse('2014-02-01') }
|
254
|
+
end
|
255
|
+
|
256
|
+
context 'Integer' do
|
257
|
+
let(:input){ 2 }
|
258
|
+
it { expect eq Date.parse('2014-02-01') }
|
259
|
+
end
|
260
|
+
|
261
|
+
context 'out of range' do
|
262
|
+
specify { expect{ ByStar::Normalization.month(0) }.to raise_error(ByStar::ParseError, 'Month must be a number between 1 and 12 or a month name') }
|
263
|
+
specify { expect{ ByStar::Normalization.month(13) }.to raise_error(ByStar::ParseError, 'Month must be a number between 1 and 12 or a month name') }
|
264
|
+
end
|
265
|
+
|
266
|
+
context 'with year option' do
|
267
|
+
let(:options){ { year: 2011 } }
|
268
|
+
|
269
|
+
context 'month abbr String' do
|
270
|
+
let(:input){ 'Dec' }
|
271
|
+
it { expect eq Date.parse('2011-12-01') }
|
272
|
+
end
|
273
|
+
|
274
|
+
context 'Integer 12' do
|
275
|
+
let(:input){ 10 }
|
276
|
+
it { expect eq Date.parse('2011-10-01') }
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
describe '#quarter' do
|
282
|
+
subject { ByStar::Normalization.quarter(input, options) }
|
283
|
+
it_behaves_like 'date normalization from string'
|
284
|
+
it_behaves_like 'date normalization from time value'
|
285
|
+
|
286
|
+
context 'Integer 1' do
|
287
|
+
let(:input){ 1 }
|
288
|
+
it { expect eq Date.parse('2014-01-01') }
|
289
|
+
end
|
290
|
+
|
291
|
+
context 'Integer 2' do
|
292
|
+
let(:input){ 2 }
|
293
|
+
it { expect eq Date.parse('2014-04-01') }
|
294
|
+
end
|
295
|
+
|
296
|
+
context 'Integer 3' do
|
297
|
+
let(:input){ 3 }
|
298
|
+
it { expect eq Date.parse('2014-07-01') }
|
299
|
+
end
|
300
|
+
|
301
|
+
context 'Integer 4' do
|
302
|
+
let(:input){ 4 }
|
303
|
+
it { expect eq Date.parse('2014-10-01') }
|
304
|
+
end
|
305
|
+
|
306
|
+
context 'with year option' do
|
307
|
+
let(:options){ { year: 2011 } }
|
308
|
+
|
309
|
+
context 'Integer 3' do
|
310
|
+
let(:input){ 3 }
|
311
|
+
it { expect eq Date.parse('2011-07-01') }
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
context 'out of range' do
|
316
|
+
specify { expect{ ByStar::Normalization.quarter(0) }.to raise_error(ByStar::ParseError, 'Quarter number must be between 1 and 4') }
|
317
|
+
specify { expect{ ByStar::Normalization.quarter(5) }.to raise_error(ByStar::ParseError, 'Quarter number must be between 1 and 4') }
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
describe '#year' do
|
322
|
+
subject { ByStar::Normalization.year(input, options) }
|
323
|
+
it_behaves_like 'date normalization from string'
|
324
|
+
it_behaves_like 'date normalization from time value'
|
325
|
+
|
326
|
+
context 'Integer 69' do
|
327
|
+
let(:input){ 69 }
|
328
|
+
it { expect eq Date.parse('2069-01-01') }
|
329
|
+
end
|
330
|
+
|
331
|
+
context 'Integer 99' do
|
332
|
+
let(:input){ 99 }
|
333
|
+
it { expect eq Date.parse('1999-01-01') }
|
334
|
+
end
|
335
|
+
|
336
|
+
context 'Integer 2001' do
|
337
|
+
let(:input){ 1 }
|
338
|
+
it { expect eq Date.parse('2001-01-01') }
|
339
|
+
end
|
340
|
+
|
341
|
+
context 'String 01' do
|
342
|
+
let(:input){ '01' }
|
343
|
+
it { expect eq Date.parse('2001-01-01') }
|
344
|
+
end
|
345
|
+
|
346
|
+
context 'String 70' do
|
347
|
+
let(:input){ '70' }
|
348
|
+
it { expect eq Date.parse('1970-01-01') }
|
349
|
+
end
|
350
|
+
|
351
|
+
context 'String 2001' do
|
352
|
+
let(:input){ '2001' }
|
353
|
+
it { expect eq Date.parse('2001-01-01') }
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
describe '#time_in_units' do
|
358
|
+
subject { ByStar::Normalization.time_in_units(input) }
|
359
|
+
|
360
|
+
context 'when less than a day' do
|
361
|
+
let(:input) { 34876 }
|
362
|
+
it { is_expected.to eq(days: 0, hour: 9, min: 41, sec: 16) }
|
363
|
+
end
|
364
|
+
|
365
|
+
context 'when more than a day' do
|
366
|
+
let(:input) { 97532 }
|
367
|
+
it { is_expected.to eq(days: 1, hour: 3, min: 5, sec: 32) }
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
describe '#apply_offset_start' do
|
372
|
+
subject { ByStar::Normalization.apply_offset_start(input, offset) }
|
373
|
+
let(:input) { Time.zone.parse('2020-04-05 00:00:00') }
|
374
|
+
let(:offset) { 5.hours }
|
375
|
+
it { is_expected.to eq Time.zone.parse('2020-04-05 05:00:00') }
|
376
|
+
end
|
377
|
+
|
378
|
+
describe '#apply_offset_end' do
|
379
|
+
subject { ByStar::Normalization.apply_offset_end(input, offset) }
|
380
|
+
let(:input) { Time.zone.parse('2020-10-04 00:00:00') }
|
381
|
+
let(:offset) { 5.hours }
|
382
|
+
it { is_expected.to eq Time.zone.parse('2020-10-05 04:59:59') }
|
383
|
+
end
|
384
|
+
end
|
data/tmp/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.log
|
metadata
ADDED
@@ -0,0 +1,298 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ta_by_star
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 4.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryan Bigg
|
8
|
+
- Johnny Shields
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2022-06-27 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 3.2.0
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 3.2.0
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: chronic
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: bundler
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: sqlite3
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: activerecord
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: mongoid
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: pg
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: mysql2
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rspec-rails
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '3.1'
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '3.1'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: timecop
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0.3'
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0.3'
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: pry
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
type: :development
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
description: ActiveRecord and Mongoid extension for easier date scopes and time ranges
|
169
|
+
email:
|
170
|
+
- radarlistener@gmail.com
|
171
|
+
executables: []
|
172
|
+
extensions: []
|
173
|
+
extra_rdoc_files: []
|
174
|
+
files:
|
175
|
+
- CHANGELOG.md
|
176
|
+
- Gemfile
|
177
|
+
- MIT-LICENSE
|
178
|
+
- README.md
|
179
|
+
- Rakefile
|
180
|
+
- UPGRADING
|
181
|
+
- by_star.gemspec
|
182
|
+
- cleaner.rb
|
183
|
+
- lib/by_star.rb
|
184
|
+
- lib/by_star/base.rb
|
185
|
+
- lib/by_star/between.rb
|
186
|
+
- lib/by_star/directional.rb
|
187
|
+
- lib/by_star/kernel/date.rb
|
188
|
+
- lib/by_star/kernel/in_time_zone.rb
|
189
|
+
- lib/by_star/kernel/time.rb
|
190
|
+
- lib/by_star/normalization.rb
|
191
|
+
- lib/by_star/orm/active_record/by_star.rb
|
192
|
+
- lib/by_star/orm/mongoid/by_star.rb
|
193
|
+
- lib/by_star/orm/mongoid/reorder.rb
|
194
|
+
- lib/by_star/version.rb
|
195
|
+
- spec/database.yml
|
196
|
+
- spec/fixtures/active_record/models.rb
|
197
|
+
- spec/fixtures/active_record/schema.rb
|
198
|
+
- spec/fixtures/mongoid/models.rb
|
199
|
+
- spec/fixtures/shared/seeds.rb
|
200
|
+
- spec/gemfiles/Gemfile.rails
|
201
|
+
- spec/gemfiles/Gemfile.rails32
|
202
|
+
- spec/gemfiles/Gemfile.rails40
|
203
|
+
- spec/gemfiles/Gemfile.rails41
|
204
|
+
- spec/gemfiles/Gemfile.rails42
|
205
|
+
- spec/gemfiles/Gemfile.rails50
|
206
|
+
- spec/gemfiles/Gemfile.rails51
|
207
|
+
- spec/gemfiles/Gemfile.rails52
|
208
|
+
- spec/gemfiles/Gemfile.rails60
|
209
|
+
- spec/gemfiles/Gemfile.rails61
|
210
|
+
- spec/integration/active_record/active_record_spec.rb
|
211
|
+
- spec/integration/mongoid/mongoid_spec.rb
|
212
|
+
- spec/integration/shared/at_time.rb
|
213
|
+
- spec/integration/shared/between_dates.rb
|
214
|
+
- spec/integration/shared/between_times.rb
|
215
|
+
- spec/integration/shared/by_calendar_month.rb
|
216
|
+
- spec/integration/shared/by_cweek.rb
|
217
|
+
- spec/integration/shared/by_day.rb
|
218
|
+
- spec/integration/shared/by_direction.rb
|
219
|
+
- spec/integration/shared/by_fortnight.rb
|
220
|
+
- spec/integration/shared/by_month.rb
|
221
|
+
- spec/integration/shared/by_quarter.rb
|
222
|
+
- spec/integration/shared/by_week.rb
|
223
|
+
- spec/integration/shared/by_weekend.rb
|
224
|
+
- spec/integration/shared/by_year.rb
|
225
|
+
- spec/integration/shared/index_scope_parameter.rb
|
226
|
+
- spec/integration/shared/offset_parameter.rb
|
227
|
+
- spec/integration/shared/order_parameter.rb
|
228
|
+
- spec/integration/shared/relative.rb
|
229
|
+
- spec/spec_helper.rb
|
230
|
+
- spec/unit/kernel_date_spec.rb
|
231
|
+
- spec/unit/kernel_time_spec.rb
|
232
|
+
- spec/unit/normalization_spec.rb
|
233
|
+
- tmp/.gitignore
|
234
|
+
homepage: http://github.com/radar/by_star
|
235
|
+
licenses: []
|
236
|
+
metadata: {}
|
237
|
+
post_install_message: |
|
238
|
+
Upgrading ByStar
|
239
|
+
----------------
|
240
|
+
|
241
|
+
* As of version 4.0.0, ByStar changes the way it handles `Date` arg to the `#between_times` method. If a `Date` is given as the second (end) arg, the query will use `Date.end_of_day` to include all time values which fall inside that date.
|
242
|
+
rdoc_options: []
|
243
|
+
require_paths:
|
244
|
+
- lib
|
245
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
246
|
+
requirements:
|
247
|
+
- - ">="
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: 2.0.0
|
250
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
251
|
+
requirements:
|
252
|
+
- - ">="
|
253
|
+
- !ruby/object:Gem::Version
|
254
|
+
version: '0'
|
255
|
+
requirements: []
|
256
|
+
rubygems_version: 3.2.15
|
257
|
+
signing_key:
|
258
|
+
specification_version: 4
|
259
|
+
summary: ActiveRecord and Mongoid extension for easier date scopes and time ranges
|
260
|
+
test_files:
|
261
|
+
- spec/database.yml
|
262
|
+
- spec/fixtures/active_record/models.rb
|
263
|
+
- spec/fixtures/active_record/schema.rb
|
264
|
+
- spec/fixtures/mongoid/models.rb
|
265
|
+
- spec/fixtures/shared/seeds.rb
|
266
|
+
- spec/gemfiles/Gemfile.rails
|
267
|
+
- spec/gemfiles/Gemfile.rails32
|
268
|
+
- spec/gemfiles/Gemfile.rails40
|
269
|
+
- spec/gemfiles/Gemfile.rails41
|
270
|
+
- spec/gemfiles/Gemfile.rails42
|
271
|
+
- spec/gemfiles/Gemfile.rails50
|
272
|
+
- spec/gemfiles/Gemfile.rails51
|
273
|
+
- spec/gemfiles/Gemfile.rails52
|
274
|
+
- spec/gemfiles/Gemfile.rails60
|
275
|
+
- spec/gemfiles/Gemfile.rails61
|
276
|
+
- spec/integration/active_record/active_record_spec.rb
|
277
|
+
- spec/integration/mongoid/mongoid_spec.rb
|
278
|
+
- spec/integration/shared/at_time.rb
|
279
|
+
- spec/integration/shared/between_dates.rb
|
280
|
+
- spec/integration/shared/between_times.rb
|
281
|
+
- spec/integration/shared/by_calendar_month.rb
|
282
|
+
- spec/integration/shared/by_cweek.rb
|
283
|
+
- spec/integration/shared/by_day.rb
|
284
|
+
- spec/integration/shared/by_direction.rb
|
285
|
+
- spec/integration/shared/by_fortnight.rb
|
286
|
+
- spec/integration/shared/by_month.rb
|
287
|
+
- spec/integration/shared/by_quarter.rb
|
288
|
+
- spec/integration/shared/by_week.rb
|
289
|
+
- spec/integration/shared/by_weekend.rb
|
290
|
+
- spec/integration/shared/by_year.rb
|
291
|
+
- spec/integration/shared/index_scope_parameter.rb
|
292
|
+
- spec/integration/shared/offset_parameter.rb
|
293
|
+
- spec/integration/shared/order_parameter.rb
|
294
|
+
- spec/integration/shared/relative.rb
|
295
|
+
- spec/spec_helper.rb
|
296
|
+
- spec/unit/kernel_date_spec.rb
|
297
|
+
- spec/unit/kernel_time_spec.rb
|
298
|
+
- spec/unit/normalization_spec.rb
|