season 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +11 -2
- data/lib/season/version.rb +1 -1
- data/season.gemspec +1 -1
- 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: ad71e236ae386e4b79309af41447cbba18b26833
|
4
|
+
data.tar.gz: 946198f7bd269368e8123916eec88f0199671704
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 161a85053768d7d9a72603be1971476460bbdd25fb39bdf5cc2f8143f334aa3fa2adb43417a10c42b168211442d625e7af5ae16ac87fa732808c2234311fc941
|
7
|
+
data.tar.gz: ead7c4c8946153bc4c70485d6f1af7964f0d3761000119af6290780d90b791981a9673349968be7cfc5f9f1ad61a2d0eadbaf6c667ccfade2d57b09e4c4dcdc9
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Season let's you easily query your Models by a specific date/time.
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem 'season', '~> 0.0.
|
10
|
+
gem 'season', '~> 0.0.6'
|
11
11
|
```
|
12
12
|
|
13
13
|
And then execute:
|
@@ -29,7 +29,7 @@ Season assumes your models have timestamps columns (created_at and updated_at) a
|
|
29
29
|
Right now, Season gives you the following helper methods:
|
30
30
|
|
31
31
|
```ruby
|
32
|
-
#
|
32
|
+
# Include it in your models
|
33
33
|
|
34
34
|
class User < ActiveRecord::Base
|
35
35
|
include Season::Scopes
|
@@ -39,6 +39,7 @@ class User < ActiveRecord::Base
|
|
39
39
|
end
|
40
40
|
|
41
41
|
# And then use it as:
|
42
|
+
# (Time/DateTime/String instances are allowed as arguments)
|
42
43
|
|
43
44
|
User.created_before(Time.now)
|
44
45
|
User.created_after(DateTime.now)
|
@@ -49,6 +50,14 @@ User.updated_after('01-01-2015')
|
|
49
50
|
User.updated_between(Time.now - 1.week, Time.now)
|
50
51
|
```
|
51
52
|
|
53
|
+
They are chainable, so you can also do things like this:
|
54
|
+
```ruby
|
55
|
+
|
56
|
+
User.where(id: [1, 2, 3]).created_before(Time.now)
|
57
|
+
User.updated_after('01-01-2015').order(created_at: :asc)
|
58
|
+
```
|
59
|
+
|
60
|
+
|
52
61
|
## Configuration
|
53
62
|
|
54
63
|
The scopes are not included by default in your models. To use them you need to include it yourself:
|
data/lib/season/version.rb
CHANGED
data/season.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["jdscosta91@gmail.com"]
|
11
11
|
spec.summary = %q{Season lets you query your ActiveRecord models by a specified period of time in an easier way.}
|
12
12
|
spec.description = %q{Season lets you query your ActiveRecord models by a specified period of time in an easier way.}
|
13
|
-
spec.homepage = "https://github.com/joaodiogocosta"
|
13
|
+
spec.homepage = "https://github.com/joaodiogocosta/season"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: season
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joao Diogo Costa
|
@@ -87,7 +87,7 @@ files:
|
|
87
87
|
- season.gemspec
|
88
88
|
- spec/scopes.rb
|
89
89
|
- spec/spec_helper.rb
|
90
|
-
homepage: https://github.com/joaodiogocosta
|
90
|
+
homepage: https://github.com/joaodiogocosta/season
|
91
91
|
licenses:
|
92
92
|
- MIT
|
93
93
|
metadata: {}
|