by_star 2.1.0.beta2 → 2.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -4
- data/.travis.yml +35 -25
- data/CHANGELOG.md +21 -0
- data/Gemfile +25 -4
- data/MIT-LICENSE +20 -20
- data/{README.markdown → README.md} +414 -348
- data/Rakefile +18 -2
- data/UPGRADING +10 -0
- data/by_star.gemspec +32 -31
- data/cleaner.rb +24 -24
- data/lib/by_star.rb +15 -71
- data/lib/by_star/base.rb +53 -0
- data/lib/by_star/between.rb +80 -0
- data/lib/by_star/directional.rb +21 -0
- data/lib/by_star/kernel.rb +41 -0
- data/lib/by_star/normalization.rb +118 -0
- data/lib/by_star/orm/active_record/by_star.rb +52 -0
- data/lib/by_star/orm/mongoid/by_star.rb +59 -0
- data/lib/by_star/version.rb +3 -3
- data/spec/database.yml +15 -15
- data/spec/fixtures/active_record/models.rb +6 -13
- data/spec/fixtures/active_record/schema.rb +11 -36
- data/spec/fixtures/mongoid/models.rb +15 -65
- data/spec/fixtures/shared/seeds.rb +16 -35
- data/spec/integration/active_record/active_record_spec.rb +50 -0
- data/spec/integration/mongoid/mongoid_spec.rb +43 -0
- data/spec/integration/shared/by_calendar_month.rb +55 -0
- data/spec/integration/shared/by_day.rb +84 -0
- data/spec/integration/shared/by_direction.rb +55 -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/offset_parameter.rb +31 -0
- data/spec/spec_helper.rb +29 -35
- data/spec/unit/kernel_time_spec.rb +57 -0
- data/spec/unit/normalization_spec.rb +255 -0
- metadata +131 -56
- data/Gemfile.lock +0 -94
- data/lib/by_star/by_day.rb +0 -34
- data/lib/by_star/by_direction.rb +0 -52
- data/lib/by_star/by_fortnight.rb +0 -58
- data/lib/by_star/by_month.rb +0 -47
- data/lib/by_star/by_quarter.rb +0 -32
- data/lib/by_star/by_week.rb +0 -32
- data/lib/by_star/by_weekend.rb +0 -20
- data/lib/by_star/by_year.rb +0 -62
- data/lib/by_star/instance_methods.rb +0 -13
- data/lib/by_star/time_ext.rb +0 -21
- data/lib/mongoid/by_star.rb +0 -83
- data/spec/by_star/active_record/active_record_spec.rb +0 -50
- data/spec/by_star/mongoid/mongoid_spec.rb +0 -44
- data/spec/by_star/shared/by_day.rb +0 -62
- data/spec/by_star/shared/by_direction.rb +0 -85
- data/spec/by_star/shared/by_fortnight.rb +0 -47
- data/spec/by_star/shared/by_month.rb +0 -109
- data/spec/by_star/shared/by_quarter.rb +0 -33
- data/spec/by_star/shared/by_week.rb +0 -41
- data/spec/by_star/shared/by_weekend.rb +0 -13
- data/spec/by_star/shared/by_year.rb +0 -54
- data/spec/time_ext_spec.rb +0 -10
metadata
CHANGED
@@ -1,16 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: by_star
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0.rc1
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ryan Bigg
|
9
|
+
- Johnny Shields
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
+
date: 2014-01-14 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: activesupport
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: chronic
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
type: :development
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
14
47
|
- !ruby/object:Gem::Dependency
|
15
48
|
name: bundler
|
16
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,7 +77,7 @@ dependencies:
|
|
44
77
|
- !ruby/object:Gem::Version
|
45
78
|
version: '0'
|
46
79
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
80
|
+
name: activerecord
|
48
81
|
requirement: !ruby/object:Gem::Requirement
|
49
82
|
none: false
|
50
83
|
requirements:
|
@@ -60,7 +93,7 @@ dependencies:
|
|
60
93
|
- !ruby/object:Gem::Version
|
61
94
|
version: '0'
|
62
95
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
96
|
+
name: mongoid
|
64
97
|
requirement: !ruby/object:Gem::Requirement
|
65
98
|
none: false
|
66
99
|
requirements:
|
@@ -76,45 +109,45 @@ dependencies:
|
|
76
109
|
- !ruby/object:Gem::Version
|
77
110
|
version: '0'
|
78
111
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
112
|
+
name: pg
|
80
113
|
requirement: !ruby/object:Gem::Requirement
|
81
114
|
none: false
|
82
115
|
requirements:
|
83
|
-
- -
|
116
|
+
- - ! '>='
|
84
117
|
- !ruby/object:Gem::Version
|
85
|
-
version: '
|
118
|
+
version: '0'
|
86
119
|
type: :development
|
87
120
|
prerelease: false
|
88
121
|
version_requirements: !ruby/object:Gem::Requirement
|
89
122
|
none: false
|
90
123
|
requirements:
|
91
|
-
- -
|
124
|
+
- - ! '>='
|
92
125
|
- !ruby/object:Gem::Version
|
93
|
-
version: '
|
126
|
+
version: '0'
|
94
127
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
128
|
+
name: mysql2
|
96
129
|
requirement: !ruby/object:Gem::Requirement
|
97
130
|
none: false
|
98
131
|
requirements:
|
99
|
-
- -
|
132
|
+
- - ! '>='
|
100
133
|
- !ruby/object:Gem::Version
|
101
|
-
version: '0
|
134
|
+
version: '0'
|
102
135
|
type: :development
|
103
136
|
prerelease: false
|
104
137
|
version_requirements: !ruby/object:Gem::Requirement
|
105
138
|
none: false
|
106
139
|
requirements:
|
107
|
-
- -
|
140
|
+
- - ! '>='
|
108
141
|
- !ruby/object:Gem::Version
|
109
|
-
version: '0
|
142
|
+
version: '0'
|
110
143
|
- !ruby/object:Gem::Dependency
|
111
|
-
name:
|
144
|
+
name: rspec-rails
|
112
145
|
requirement: !ruby/object:Gem::Requirement
|
113
146
|
none: false
|
114
147
|
requirements:
|
115
148
|
- - ~>
|
116
149
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
150
|
+
version: '2.14'
|
118
151
|
type: :development
|
119
152
|
prerelease: false
|
120
153
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -122,32 +155,32 @@ dependencies:
|
|
122
155
|
requirements:
|
123
156
|
- - ~>
|
124
157
|
- !ruby/object:Gem::Version
|
125
|
-
version: '
|
158
|
+
version: '2.14'
|
126
159
|
- !ruby/object:Gem::Dependency
|
127
|
-
name:
|
160
|
+
name: timecop
|
128
161
|
requirement: !ruby/object:Gem::Requirement
|
129
162
|
none: false
|
130
163
|
requirements:
|
131
164
|
- - ~>
|
132
165
|
- !ruby/object:Gem::Version
|
133
|
-
version: '3
|
134
|
-
type: :
|
166
|
+
version: '0.3'
|
167
|
+
type: :development
|
135
168
|
prerelease: false
|
136
169
|
version_requirements: !ruby/object:Gem::Requirement
|
137
170
|
none: false
|
138
171
|
requirements:
|
139
172
|
- - ~>
|
140
173
|
- !ruby/object:Gem::Version
|
141
|
-
version: '3
|
174
|
+
version: '0.3'
|
142
175
|
- !ruby/object:Gem::Dependency
|
143
|
-
name:
|
176
|
+
name: pry
|
144
177
|
requirement: !ruby/object:Gem::Requirement
|
145
178
|
none: false
|
146
179
|
requirements:
|
147
180
|
- - ! '>='
|
148
181
|
- !ruby/object:Gem::Version
|
149
182
|
version: '0'
|
150
|
-
type: :
|
183
|
+
type: :development
|
151
184
|
prerelease: false
|
152
185
|
version_requirements: !ruby/object:Gem::Requirement
|
153
186
|
none: false
|
@@ -155,7 +188,7 @@ dependencies:
|
|
155
188
|
- - ! '>='
|
156
189
|
- !ruby/object:Gem::Version
|
157
190
|
version: '0'
|
158
|
-
description: ActiveRecord extension for easier date scopes and time ranges
|
191
|
+
description: ActiveRecord and Mongoid extension for easier date scopes and time ranges
|
159
192
|
email:
|
160
193
|
- radarlistener@gmail.com
|
161
194
|
executables: []
|
@@ -164,47 +197,70 @@ extra_rdoc_files: []
|
|
164
197
|
files:
|
165
198
|
- .gitignore
|
166
199
|
- .travis.yml
|
200
|
+
- CHANGELOG.md
|
167
201
|
- Gemfile
|
168
|
-
- Gemfile.lock
|
169
202
|
- MIT-LICENSE
|
170
|
-
- README.
|
203
|
+
- README.md
|
171
204
|
- Rakefile
|
205
|
+
- UPGRADING
|
172
206
|
- by_star.gemspec
|
173
207
|
- cleaner.rb
|
174
208
|
- lib/by_star.rb
|
175
|
-
- lib/by_star/
|
176
|
-
- lib/by_star/
|
177
|
-
- lib/by_star/
|
178
|
-
- lib/by_star/
|
179
|
-
- lib/by_star/
|
180
|
-
- lib/by_star/
|
181
|
-
- lib/by_star/
|
182
|
-
- lib/by_star/by_year.rb
|
183
|
-
- lib/by_star/instance_methods.rb
|
184
|
-
- lib/by_star/time_ext.rb
|
209
|
+
- lib/by_star/base.rb
|
210
|
+
- lib/by_star/between.rb
|
211
|
+
- lib/by_star/directional.rb
|
212
|
+
- lib/by_star/kernel.rb
|
213
|
+
- lib/by_star/normalization.rb
|
214
|
+
- lib/by_star/orm/active_record/by_star.rb
|
215
|
+
- lib/by_star/orm/mongoid/by_star.rb
|
185
216
|
- lib/by_star/version.rb
|
186
|
-
- lib/mongoid/by_star.rb
|
187
|
-
- spec/by_star/active_record/active_record_spec.rb
|
188
|
-
- spec/by_star/mongoid/mongoid_spec.rb
|
189
|
-
- spec/by_star/shared/by_day.rb
|
190
|
-
- spec/by_star/shared/by_direction.rb
|
191
|
-
- spec/by_star/shared/by_fortnight.rb
|
192
|
-
- spec/by_star/shared/by_month.rb
|
193
|
-
- spec/by_star/shared/by_quarter.rb
|
194
|
-
- spec/by_star/shared/by_week.rb
|
195
|
-
- spec/by_star/shared/by_weekend.rb
|
196
|
-
- spec/by_star/shared/by_year.rb
|
197
217
|
- spec/database.yml
|
198
218
|
- spec/fixtures/active_record/models.rb
|
199
219
|
- spec/fixtures/active_record/schema.rb
|
200
220
|
- spec/fixtures/mongoid/models.rb
|
201
221
|
- spec/fixtures/shared/seeds.rb
|
222
|
+
- spec/integration/active_record/active_record_spec.rb
|
223
|
+
- spec/integration/mongoid/mongoid_spec.rb
|
224
|
+
- spec/integration/shared/by_calendar_month.rb
|
225
|
+
- spec/integration/shared/by_day.rb
|
226
|
+
- spec/integration/shared/by_direction.rb
|
227
|
+
- spec/integration/shared/by_fortnight.rb
|
228
|
+
- spec/integration/shared/by_month.rb
|
229
|
+
- spec/integration/shared/by_quarter.rb
|
230
|
+
- spec/integration/shared/by_week.rb
|
231
|
+
- spec/integration/shared/by_weekend.rb
|
232
|
+
- spec/integration/shared/by_year.rb
|
233
|
+
- spec/integration/shared/offset_parameter.rb
|
202
234
|
- spec/spec_helper.rb
|
203
|
-
- spec/
|
235
|
+
- spec/unit/kernel_time_spec.rb
|
236
|
+
- spec/unit/normalization_spec.rb
|
204
237
|
- tmp/.gitignore
|
205
238
|
homepage: http://github.com/radar/by_star
|
206
239
|
licenses: []
|
207
|
-
post_install_message:
|
240
|
+
post_install_message: ! 'Upgrading to ByStar 2.2.0
|
241
|
+
|
242
|
+
-------------------------
|
243
|
+
|
244
|
+
|
245
|
+
* For Mongoid only, ByStar''s `.between` method has been removed and replaced with
|
246
|
+
`.between_times`
|
247
|
+
|
248
|
+
(previously `.between_times` was an alias to `.between`). Mongoid already provides
|
249
|
+
a native `.between`
|
250
|
+
|
251
|
+
finder method that we do not want to mask. ActiveRecord users may continue to use
|
252
|
+
either method.
|
253
|
+
|
254
|
+
|
255
|
+
* Chronic gem (used for time string parsing) has been removed as a hard dependency
|
256
|
+
for ByStar,
|
257
|
+
|
258
|
+
however it is still supported. If you would like to use Chronic with ByStar, please
|
259
|
+
explicitly
|
260
|
+
|
261
|
+
include `gem chronic` into your Gemfile.
|
262
|
+
|
263
|
+
'
|
208
264
|
rdoc_options: []
|
209
265
|
require_paths:
|
210
266
|
- lib
|
@@ -217,14 +273,33 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
217
273
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
274
|
none: false
|
219
275
|
requirements:
|
220
|
-
- - ! '
|
276
|
+
- - ! '>'
|
221
277
|
- !ruby/object:Gem::Version
|
222
|
-
version: 1.3.
|
278
|
+
version: 1.3.1
|
223
279
|
requirements: []
|
224
|
-
rubyforge_project:
|
225
|
-
rubygems_version: 1.8.
|
280
|
+
rubyforge_project:
|
281
|
+
rubygems_version: 1.8.28
|
226
282
|
signing_key:
|
227
283
|
specification_version: 3
|
228
|
-
summary: ActiveRecord extension for easier date scopes and time ranges
|
229
|
-
test_files:
|
230
|
-
|
284
|
+
summary: ActiveRecord and Mongoid extension for easier date scopes and time ranges
|
285
|
+
test_files:
|
286
|
+
- spec/database.yml
|
287
|
+
- spec/fixtures/active_record/models.rb
|
288
|
+
- spec/fixtures/active_record/schema.rb
|
289
|
+
- spec/fixtures/mongoid/models.rb
|
290
|
+
- spec/fixtures/shared/seeds.rb
|
291
|
+
- spec/integration/active_record/active_record_spec.rb
|
292
|
+
- spec/integration/mongoid/mongoid_spec.rb
|
293
|
+
- spec/integration/shared/by_calendar_month.rb
|
294
|
+
- spec/integration/shared/by_day.rb
|
295
|
+
- spec/integration/shared/by_direction.rb
|
296
|
+
- spec/integration/shared/by_fortnight.rb
|
297
|
+
- spec/integration/shared/by_month.rb
|
298
|
+
- spec/integration/shared/by_quarter.rb
|
299
|
+
- spec/integration/shared/by_week.rb
|
300
|
+
- spec/integration/shared/by_weekend.rb
|
301
|
+
- spec/integration/shared/by_year.rb
|
302
|
+
- spec/integration/shared/offset_parameter.rb
|
303
|
+
- spec/spec_helper.rb
|
304
|
+
- spec/unit/kernel_time_spec.rb
|
305
|
+
- spec/unit/normalization_spec.rb
|
data/Gemfile.lock
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
by_star (2.0.0.beta1)
|
5
|
-
activerecord (~> 3.0)
|
6
|
-
chronic
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: http://rubygems.org/
|
10
|
-
specs:
|
11
|
-
actionpack (3.2.8)
|
12
|
-
activemodel (= 3.2.8)
|
13
|
-
activesupport (= 3.2.8)
|
14
|
-
builder (~> 3.0.0)
|
15
|
-
erubis (~> 2.7.0)
|
16
|
-
journey (~> 1.0.4)
|
17
|
-
rack (~> 1.4.0)
|
18
|
-
rack-cache (~> 1.2)
|
19
|
-
rack-test (~> 0.6.1)
|
20
|
-
sprockets (~> 2.1.3)
|
21
|
-
activemodel (3.2.8)
|
22
|
-
activesupport (= 3.2.8)
|
23
|
-
builder (~> 3.0.0)
|
24
|
-
activerecord (3.2.8)
|
25
|
-
activemodel (= 3.2.8)
|
26
|
-
activesupport (= 3.2.8)
|
27
|
-
arel (~> 3.0.2)
|
28
|
-
tzinfo (~> 0.3.29)
|
29
|
-
activesupport (3.2.8)
|
30
|
-
i18n (~> 0.6)
|
31
|
-
multi_json (~> 1.0)
|
32
|
-
arel (3.0.2)
|
33
|
-
builder (3.0.0)
|
34
|
-
chronic (0.7.0)
|
35
|
-
diff-lcs (1.1.3)
|
36
|
-
erubis (2.7.0)
|
37
|
-
hike (1.2.1)
|
38
|
-
i18n (0.6.1)
|
39
|
-
journey (1.0.4)
|
40
|
-
json (1.7.5)
|
41
|
-
multi_json (1.3.6)
|
42
|
-
mysql2 (0.3.11)
|
43
|
-
pg (0.14.0)
|
44
|
-
rack (1.4.1)
|
45
|
-
rack-cache (1.2)
|
46
|
-
rack (>= 0.4)
|
47
|
-
rack-ssl (1.3.2)
|
48
|
-
rack
|
49
|
-
rack-test (0.6.1)
|
50
|
-
rack (>= 1.0)
|
51
|
-
railties (3.2.8)
|
52
|
-
actionpack (= 3.2.8)
|
53
|
-
activesupport (= 3.2.8)
|
54
|
-
rack-ssl (~> 1.3.2)
|
55
|
-
rake (>= 0.8.7)
|
56
|
-
rdoc (~> 3.4)
|
57
|
-
thor (>= 0.14.6, < 2.0)
|
58
|
-
rake (0.9.2.2)
|
59
|
-
rdoc (3.12)
|
60
|
-
json (~> 1.4)
|
61
|
-
rspec (2.11.0)
|
62
|
-
rspec-core (~> 2.11.0)
|
63
|
-
rspec-expectations (~> 2.11.0)
|
64
|
-
rspec-mocks (~> 2.11.0)
|
65
|
-
rspec-core (2.11.1)
|
66
|
-
rspec-expectations (2.11.2)
|
67
|
-
diff-lcs (~> 1.1.3)
|
68
|
-
rspec-mocks (2.11.2)
|
69
|
-
rspec-rails (2.11.0)
|
70
|
-
actionpack (>= 3.0)
|
71
|
-
activesupport (>= 3.0)
|
72
|
-
railties (>= 3.0)
|
73
|
-
rspec (~> 2.11.0)
|
74
|
-
sprockets (2.1.3)
|
75
|
-
hike (~> 1.2)
|
76
|
-
rack (~> 1.0)
|
77
|
-
tilt (~> 1.1, != 1.3.0)
|
78
|
-
sqlite3 (1.3.6)
|
79
|
-
thor (0.16.0)
|
80
|
-
tilt (1.3.3)
|
81
|
-
timecop (0.4.5)
|
82
|
-
tzinfo (0.3.33)
|
83
|
-
|
84
|
-
PLATFORMS
|
85
|
-
ruby
|
86
|
-
|
87
|
-
DEPENDENCIES
|
88
|
-
bundler (>= 1.0.0)
|
89
|
-
by_star!
|
90
|
-
mysql2
|
91
|
-
pg
|
92
|
-
rspec-rails (~> 2.8)
|
93
|
-
sqlite3
|
94
|
-
timecop (~> 0.3)
|
data/lib/by_star/by_day.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
module ByStar
|
2
|
-
module ByDay
|
3
|
-
def by_day(*args)
|
4
|
-
options = args.extract_options!.symbolize_keys!
|
5
|
-
time = args.first
|
6
|
-
time ||= Time.zone.local(options[:year], 1, 1) if options[:year]
|
7
|
-
time ||= Time.zone.now
|
8
|
-
send("by_day_#{time_klass(time)}", time, options)
|
9
|
-
end
|
10
|
-
|
11
|
-
def today(options={})
|
12
|
-
by_day_Time(Time.zone.now, options)
|
13
|
-
end
|
14
|
-
|
15
|
-
def yesterday(options={})
|
16
|
-
by_day_Time(Time.zone.now.yesterday, options)
|
17
|
-
end
|
18
|
-
|
19
|
-
def tomorrow(options={})
|
20
|
-
by_day_Time(Time.zone.now.tomorrow, options)
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def by_day_Time(time, options)
|
26
|
-
between(time.beginning_of_day, time.end_of_day, options)
|
27
|
-
end
|
28
|
-
alias_method :by_day_Date, :by_day_Time
|
29
|
-
|
30
|
-
def by_day_String(string, options)
|
31
|
-
by_day_Time(Time.parse(string), options)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
data/lib/by_star/by_direction.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
module ByStar
|
2
|
-
module ByDirection
|
3
|
-
def before(*args)
|
4
|
-
options = args.extract_options!.symbolize_keys!
|
5
|
-
time = args.first || Time.zone.now
|
6
|
-
send("before_#{time_klass(time)}", time, options)
|
7
|
-
end
|
8
|
-
alias_method :before_now, :before
|
9
|
-
|
10
|
-
def after(*args)
|
11
|
-
options = args.extract_options!.symbolize_keys!
|
12
|
-
time = args.first || Time.zone.now
|
13
|
-
send("after_#{time_klass(time)}", time, options)
|
14
|
-
end
|
15
|
-
alias_method :after_now, :after
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def before_Time_or_Date(time_or_date, options={})
|
20
|
-
field = options[:field] || by_star_field
|
21
|
-
where("#{field} <= ?", time_or_date)
|
22
|
-
end
|
23
|
-
alias_method :before_Time, :before_Time_or_Date
|
24
|
-
alias_method :before_Date, :before_Time_or_Date
|
25
|
-
|
26
|
-
def before_String(string, options={})
|
27
|
-
field = options[:field] || by_star_field
|
28
|
-
if time = Chronic.parse(string)
|
29
|
-
where("#{field} <= ?", time)
|
30
|
-
else
|
31
|
-
raise ParseError, "Chronic couldn't understand #{string.inspect}. Please try something else."
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def after_Time_or_Date(time_or_date, options={})
|
36
|
-
field = options[:field] || by_star_field
|
37
|
-
where("#{field} >= ?", time_or_date)
|
38
|
-
end
|
39
|
-
alias_method :after_Time, :after_Time_or_Date
|
40
|
-
alias_method :after_Date, :after_Time_or_Date
|
41
|
-
|
42
|
-
def after_String(string, options={})
|
43
|
-
field = options[:field] || by_star_field
|
44
|
-
if time = Chronic.parse(string)
|
45
|
-
where("#{field} >= ?", time)
|
46
|
-
else
|
47
|
-
raise ParseError, "Chronic couldn't understand #{string.inspect}. Please try something else."
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|