fortnight 0.0.1rc → 0.0.1rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/LICENSE +1 -1
- data/README.md +31 -13
- data/fortnight.gemspec +1 -1
- data/lib/fortnight.rb +0 -1
- data/lib/fortnight/version.rb +1 -1
- metadata +4 -4
data/.gitignore
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,29 +1,47 @@
|
|
1
1
|
# Fortnight
|
2
2
|
|
3
|
-
|
3
|
+
Scope to difference by first and second half month.
|
4
|
+
|
5
|
+
The gem work separing the month of a year in two half, first - 15th and 16th - last day
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
7
|
-
Add
|
9
|
+
Add the gem to your Gemfile
|
8
10
|
|
9
11
|
gem 'fortnight'
|
10
12
|
|
11
|
-
|
13
|
+
and run:
|
12
14
|
|
13
|
-
$ bundle
|
15
|
+
$ bundle install/update
|
14
16
|
|
15
|
-
|
17
|
+
Add in the models that we want to use
|
16
18
|
|
17
|
-
|
19
|
+
include Fortnight
|
18
20
|
|
19
21
|
## Usage
|
20
22
|
|
21
|
-
|
23
|
+
It's very simple, the syntax is the next:
|
24
|
+
|
25
|
+
Model.in_fortnight(year, month, options)
|
26
|
+
|
27
|
+
'options' for now are only :field and :half
|
28
|
+
:field ALWAYS HAVE TO BE A TIME FIELD
|
29
|
+
:half is to get the first (by default) or the second (as symbol)
|
30
|
+
|
31
|
+
Examples:
|
32
|
+
|
33
|
+
Customer.in_fortnight(2012, 04)
|
34
|
+
We'll get the customers created_at between 2012-04-01 00:00 AND 2012-04-15 23:59:59
|
35
|
+
|
36
|
+
Customer.in_fortnight(2012, 04, half: :second)
|
37
|
+
We'll get the customers created_at between 2012-04-15 23:59:59 AND 2012-04-30 23:59:59
|
38
|
+
|
39
|
+
Customer.in_fortnight(2012, 05, half: :second)
|
40
|
+
We'll get the customers created_at between 2012-05-15 23:59:59 AND 2012-05-31 23:59:59
|
41
|
+
|
42
|
+
Customer.in_fortnight(2012, 04, field: 'updated_at')
|
43
|
+
We'll get the customers updated_at between 2012-04-01 00:00 AND 2012-04-15 23:59
|
22
44
|
|
23
|
-
|
45
|
+
Customer.in_fortnight(2012, 04, half: :second, field: 'updated_at')
|
46
|
+
We'll get the customers updated_at between 2012-04-15 23:59:59 AND 2012-04-30 23:59:59
|
24
47
|
|
25
|
-
1. Fork it
|
26
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
data/fortnight.gemspec
CHANGED
data/lib/fortnight.rb
CHANGED
data/lib/fortnight/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fortnight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1rc1
|
5
5
|
prerelease: 5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -16,15 +16,15 @@ dependencies:
|
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- - '
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 3.1.0
|
22
|
-
type: :
|
22
|
+
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- - '
|
27
|
+
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 3.1.0
|
30
30
|
description: Scope to difference by first and second half month
|