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 CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ /nbproject/private/
data/LICENSE CHANGED
@@ -1,5 +1,5 @@
1
1
  Copyright (c) 2012 Néstor Coppi
2
-
2
+ Gem for fortnights global-scope
3
3
  MIT License
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
data/README.md CHANGED
@@ -1,29 +1,47 @@
1
1
  # Fortnight
2
2
 
3
- TODO: Write a gem description
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 this line to your application's Gemfile:
9
+ Add the gem to your Gemfile
8
10
 
9
11
  gem 'fortnight'
10
12
 
11
- And then execute:
13
+ and run:
12
14
 
13
- $ bundle
15
+ $ bundle install/update
14
16
 
15
- Or install it yourself as:
17
+ Add in the models that we want to use
16
18
 
17
- $ gem install fortnight
19
+ include Fortnight
18
20
 
19
21
  ## Usage
20
22
 
21
- TODO: Write usage instructions here
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
- ## Contributing
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
@@ -15,5 +15,5 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Fortnight::VERSION
17
17
 
18
- gem.add_development_dependency 'rails', '3.1.0'
18
+ gem.add_dependency 'rails', '>= 3.1.0'
19
19
  end
data/lib/fortnight.rb CHANGED
@@ -22,4 +22,3 @@ module Fortnight
22
22
  scope
23
23
  end
24
24
  end
25
- end
@@ -1,3 +1,3 @@
1
1
  module Fortnight
2
- VERSION = "0.0.1rc"
2
+ VERSION = "0.0.1rc1"
3
3
  end
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.1rc
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: :development
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