datescope 0.0.1 → 0.0.2

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.
data/README.md CHANGED
@@ -26,8 +26,9 @@ Or install it yourself as:
26
26
 
27
27
  end
28
28
 
29
- number_of_user_registered_today = User.registered.today.count
30
- all_users_registered_last_month = User.registered.last_month.all
29
+ User.registered.today.count
30
+ User.registered.last_month.all
31
+ User.registered.
31
32
 
32
33
 
33
34
  ## Contributing
@@ -2,11 +2,27 @@ module DateScope
2
2
 
3
3
  module Extension
4
4
  def today
5
- where("created_at > ?", 0.day.ago.beginning_of_day)
5
+ where("created_at >= ?", 0.day.ago.beginning_of_day)
6
+ end
7
+
8
+ def this_week
9
+ where("created_at >= ?", 0.week.ago.beginning_of_week)
6
10
  end
7
11
 
8
12
  def this_month
9
- where("created_at > ?", 0.month.ago.beginning_of_month)
13
+ where("created_at >= ?", 0.month.ago.beginning_of_month)
14
+ end
15
+
16
+ def last_month
17
+ where("created_at >= ? and created_ay <= ?", 1.month.ago.beginning_of_month, 1.month.ago.end_of_month)
18
+ end
19
+
20
+ def month_before_last_month
21
+ where("created_at >= ? and created_ay <= ?", 2.month.ago.beginning_of_month, 2.month.ago.end_of_month)
22
+ end
23
+
24
+ def this_year
25
+ where("created_at >= ?", 0.year.ago.beginning_of_year)
10
26
  end
11
27
  end
12
28
 
@@ -1,3 +1,3 @@
1
1
  module Datescope
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/datescope.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/datescope/version"
2
- require File.dirname(__FILE__) + "/datescope/base.rb"
1
+ require "datescope/version"
2
+ require "datescope/base.rb"
3
3
 
4
4
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: datescope
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Laszlo Papp