by_star 2.2.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +5 -13
  2. data/.gitignore +5 -5
  3. data/.travis.yml +61 -35
  4. data/CHANGELOG.md +44 -35
  5. data/Gemfile +18 -25
  6. data/MIT-LICENSE +20 -20
  7. data/README.md +577 -540
  8. data/Rakefile +18 -18
  9. data/UPGRADING +6 -12
  10. data/by_star.gemspec +34 -32
  11. data/cleaner.rb +24 -24
  12. data/lib/by_star.rb +17 -16
  13. data/lib/by_star/base.rb +68 -70
  14. data/lib/by_star/between.rb +156 -120
  15. data/lib/by_star/directional.rb +37 -33
  16. data/lib/by_star/kernel/date.rb +50 -19
  17. data/lib/by_star/kernel/time.rb +41 -41
  18. data/lib/by_star/normalization.rb +127 -118
  19. data/lib/by_star/orm/active_record/by_star.rb +61 -69
  20. data/lib/by_star/orm/mongoid/by_star.rb +76 -73
  21. data/lib/by_star/orm/mongoid/reorder.rb +23 -0
  22. data/lib/by_star/version.rb +3 -3
  23. data/spec/database.yml +15 -15
  24. data/spec/fixtures/active_record/models.rb +12 -10
  25. data/spec/fixtures/active_record/schema.rb +19 -19
  26. data/spec/fixtures/mongoid/models.rb +31 -29
  27. data/spec/fixtures/shared/seeds.rb +26 -26
  28. data/spec/gemfiles/Gemfile.master +6 -0
  29. data/spec/gemfiles/Gemfile.rails40 +7 -0
  30. data/spec/gemfiles/Gemfile.rails41 +7 -0
  31. data/spec/gemfiles/Gemfile.rails42 +7 -0
  32. data/spec/gemfiles/Gemfile.rails50 +10 -0
  33. data/spec/gemfiles/Gemfile.rails51 +10 -0
  34. data/spec/integration/active_record/active_record_spec.rb +38 -53
  35. data/spec/integration/mongoid/mongoid_spec.rb +37 -46
  36. data/spec/integration/shared/between_times.rb +82 -0
  37. data/spec/integration/shared/by_calendar_month.rb +55 -55
  38. data/spec/integration/shared/by_cweek.rb +54 -0
  39. data/spec/integration/shared/by_day.rb +96 -108
  40. data/spec/integration/shared/by_direction.rb +172 -153
  41. data/spec/integration/shared/by_fortnight.rb +48 -48
  42. data/spec/integration/shared/by_month.rb +50 -50
  43. data/spec/integration/shared/by_quarter.rb +49 -49
  44. data/spec/integration/shared/by_week.rb +54 -54
  45. data/spec/integration/shared/by_weekend.rb +49 -49
  46. data/spec/integration/shared/by_year.rb +48 -48
  47. data/spec/integration/shared/offset_parameter.rb +32 -31
  48. data/spec/integration/shared/order_parameter.rb +36 -0
  49. data/spec/integration/shared/relative.rb +174 -174
  50. data/spec/integration/shared/scope_parameter.rb +73 -72
  51. data/spec/spec_helper.rb +29 -29
  52. data/spec/unit/kernel_date_spec.rb +113 -60
  53. data/spec/unit/kernel_time_spec.rb +57 -57
  54. data/spec/unit/normalization_spec.rb +305 -255
  55. metadata +61 -62
data/Rakefile CHANGED
@@ -1,18 +1,18 @@
1
- require 'bundler'
2
- require 'rspec/core/rake_task'
3
-
4
- Bundler::GemHelper.install_tasks
5
- RSpec::Core::RakeTask.new(:spec)
6
-
7
- def orm_test(orm)
8
- RSpec::Core::RakeTask.new(orm) do |task|
9
- task.pattern = "./spec/{unit,integration/#{orm}}/{,/*/**}/*_spec.rb"
10
- end
11
- end
12
-
13
- namespace :spec do
14
- orm_test 'active_record'
15
- orm_test 'mongoid'
16
- end
17
-
18
- task default: :spec
1
+ require 'bundler'
2
+ require 'rspec/core/rake_task'
3
+
4
+ Bundler::GemHelper.install_tasks
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ def orm_test(orm)
8
+ RSpec::Core::RakeTask.new(orm) do |task|
9
+ task.pattern = "./spec/{unit,integration/#{orm}}/{,/*/**}/*_spec.rb"
10
+ end
11
+ end
12
+
13
+ namespace :spec do
14
+ orm_test 'active_record'
15
+ orm_test 'mongoid'
16
+ end
17
+
18
+ task default: :spec
data/UPGRADING CHANGED
@@ -1,12 +1,6 @@
1
- Upgrading ByStar
2
- ----------------
3
-
4
- * ActiveRecord: the `between` method has been deprecated as of version 2.2.0, and will be removed in version 3.0.0.
5
- Please use `between_times` instead.
6
-
7
- * Mongoid: the `between` method has been removed as of version 2.2.0, as it conflicts with the native Mongoid `between`
8
- method. Please use `between_times` instead.
9
-
10
- * Chronic gem (used for time string parsing) has been removed as a hard dependency for ByStar,
11
- however it is still supported. If you would like to use Chronic with ByStar, please explicitly
12
- include `gem chronic` into your Gemfile.
1
+ Upgrading ByStar
2
+ ----------------
3
+
4
+ * Chronic gem (used for time string parsing) has been removed as a hard dependency for ByStar,
5
+ however it is still supported. If you would like to use Chronic with ByStar, please explicitly
6
+ include `gem chronic` into your Gemfile.
@@ -1,32 +1,34 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path("../lib/by_star/version", __FILE__)
3
-
4
- Gem::Specification.new do |s|
5
- s.name = "by_star"
6
- s.version = ByStar::VERSION
7
- s.authors = ["Ryan Bigg", "Johnny Shields"]
8
- s.email = ["radarlistener@gmail.com"]
9
- s.homepage = "http://github.com/radar/by_star"
10
- s.summary = "ActiveRecord and Mongoid extension for easier date scopes and time ranges"
11
- s.description = "ActiveRecord and Mongoid extension for easier date scopes and time ranges"
12
-
13
- s.post_install_message = File.read('UPGRADING') if File.exists?('UPGRADING')
14
-
15
- s.add_dependency "activesupport"
16
-
17
- s.add_development_dependency "chronic"
18
- s.add_development_dependency "bundler", ">= 1.0.0"
19
- s.add_development_dependency "sqlite3"
20
- s.add_development_dependency "activerecord"
21
- s.add_development_dependency "mongoid"
22
- s.add_development_dependency "pg"
23
- s.add_development_dependency "mysql2"
24
- s.add_development_dependency "rspec-rails", "~> 2.14"
25
- s.add_development_dependency "timecop", "~> 0.3"
26
- s.add_development_dependency "pry"
27
-
28
- s.files = `git ls-files`.split($/)
29
- s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
30
- s.test_files = s.files.grep(%r{^(test|spec|features)/})
31
- s.require_paths = ['lib']
32
- end
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path("../lib/by_star/version", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "by_star"
6
+ s.version = ByStar::VERSION
7
+ s.authors = ["Ryan Bigg", "Johnny Shields"]
8
+ s.email = ["radarlistener@gmail.com"]
9
+ s.homepage = "http://github.com/radar/by_star"
10
+ s.summary = "ActiveRecord and Mongoid extension for easier date scopes and time ranges"
11
+ s.description = "ActiveRecord and Mongoid extension for easier date scopes and time ranges"
12
+
13
+ s.required_ruby_version = '>= 2.0.0'
14
+
15
+ s.post_install_message = File.read('UPGRADING') if File.exists?('UPGRADING')
16
+
17
+ s.add_dependency "activesupport", "> 3"
18
+
19
+ s.add_development_dependency "chronic"
20
+ s.add_development_dependency "bundler"
21
+ s.add_development_dependency "sqlite3"
22
+ s.add_development_dependency "activerecord"
23
+ s.add_development_dependency "mongoid"
24
+ s.add_development_dependency "pg"
25
+ s.add_development_dependency "mysql2", "~> 0.3.10"
26
+ s.add_development_dependency "rspec-rails", "~> 3.1"
27
+ s.add_development_dependency "timecop", "~> 0.3"
28
+ s.add_development_dependency "pry"
29
+
30
+ s.files = `git ls-files`.split($/)
31
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
32
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
33
+ s.require_paths = ['lib']
34
+ end
data/cleaner.rb CHANGED
@@ -1,25 +1,25 @@
1
- files = Dir["**/*"]
2
- ignored_files = [
3
- /log\/.*/,
4
- ]
5
-
6
- files.delete_if do |file|
7
- if File.directory?(file)
8
- true
9
- else
10
- ignored_files.any? do |condition|
11
- if condition.is_a?(String)
12
- file == condition
13
- else
14
- condition.match(file)
15
- end
16
- end || false
17
- end
18
- end
19
-
20
- for file in files - ignored_files
21
- if File.file?(file)
22
- lines = File.readlines(file).map { |line| line.gsub(/^\s+$/, "\n") }
23
- File.open(file, "w+") { |f| f.write(lines.join) }
24
- end
1
+ files = Dir["**/*"]
2
+ ignored_files = [
3
+ /log\/.*/,
4
+ ]
5
+
6
+ files.delete_if do |file|
7
+ if File.directory?(file)
8
+ true
9
+ else
10
+ ignored_files.any? do |condition|
11
+ if condition.is_a?(String)
12
+ file == condition
13
+ else
14
+ condition.match(file)
15
+ end
16
+ end || false
17
+ end
18
+ end
19
+
20
+ for file in files - ignored_files
21
+ if File.file?(file)
22
+ lines = File.readlines(file).map { |line| line.gsub(/^\s+$/, "\n") }
23
+ File.open(file, "w+") { |f| f.write(lines.join) }
24
+ end
25
25
  end
@@ -1,16 +1,17 @@
1
- require 'by_star/kernel/time'
2
- require 'by_star/kernel/date'
3
- require 'by_star/normalization'
4
- require 'by_star/between'
5
- require 'by_star/directional'
6
- require 'by_star/base'
7
-
8
- if defined?(ActiveRecord)
9
- require 'by_star/orm/active_record/by_star'
10
- ActiveRecord::Base.send :include, ByStar::ActiveRecord
11
- ActiveRecord::Relation.send :extend, ByStar::ActiveRecord::ClassMethods
12
- end
13
-
14
- if defined?(Mongoid)
15
- require 'by_star/orm/mongoid/by_star'
16
- end
1
+ require 'by_star/kernel/time'
2
+ require 'by_star/kernel/date'
3
+ require 'by_star/normalization'
4
+ require 'by_star/between'
5
+ require 'by_star/directional'
6
+ require 'by_star/base'
7
+
8
+ if defined?(ActiveRecord)
9
+ require 'by_star/orm/active_record/by_star'
10
+ ActiveRecord::Base.send :include, ByStar::ActiveRecord
11
+ ActiveRecord::Relation.send :extend, ByStar::ActiveRecord::ClassMethods
12
+ end
13
+
14
+ if defined?(Mongoid)
15
+ require 'by_star/orm/mongoid/reorder'
16
+ require 'by_star/orm/mongoid/by_star'
17
+ end
@@ -1,70 +1,68 @@
1
- module ByStar
2
-
3
- module Base
4
-
5
- include ByStar::Between
6
- include ByStar::Directional
7
-
8
- def by_star_field(*args)
9
- options = args.extract_options!
10
- @by_star_start_field ||= args[0]
11
- @by_star_end_field ||= args[1]
12
- @by_star_offset ||= options[:offset]
13
- @by_star_scope ||= options[:scope]
14
- end
15
-
16
- def by_star_offset(options = {})
17
- (options[:offset] || @by_star_offset || 0).seconds
18
- end
19
-
20
- def by_star_start_field(options={})
21
- field = options[:field] ||
22
- options[:start_field] ||
23
- @by_star_start_field ||
24
- by_star_default_field
25
- field.to_s
26
- end
27
-
28
- def by_star_end_field(options={})
29
- field = options[:field] ||
30
- options[:end_field] ||
31
- @by_star_end_field ||
32
- by_star_start_field
33
- field.to_s
34
- end
35
-
36
- def by_star_scope(options={})
37
- scope = options[:scope] || @by_star_scope || self
38
- if scope.is_a?(Proc)
39
- if scope.arity == 0
40
- return instance_exec(&scope)
41
- elsif options[:scope_args]
42
- return instance_exec(*Array(options[:scope_args]), &scope)
43
- else
44
- raise 'ByStar :scope does not accept arguments'
45
- end
46
- else
47
- return scope
48
- end
49
- end
50
-
51
- protected
52
-
53
- # Wrapper function which extracts time and options for each by_star query.
54
- # Note the following syntax examples are valid:
55
- #
56
- # Post.by_month # defaults to current time
57
- # Post.by_month(2, :year => 2004) # February, 2004
58
- # Post.by_month(Time.now)
59
- # Post.by_month(Time.now, :field => "published_at")
60
- # Post.by_month(:field => "published_at")
61
- #
62
- def with_by_star_options(*args, &block)
63
- options = args.extract_options!.symbolize_keys!
64
- time = args.first
65
- time ||= Time.zone.local(options[:year]) if options[:year]
66
- time ||= Time.zone.now
67
- block.call(time, options)
68
- end
69
- end
70
- end
1
+ module ByStar
2
+
3
+ module Base
4
+
5
+ include ByStar::Between
6
+ include ByStar::Directional
7
+
8
+ def by_star_field(*args)
9
+ options = args.extract_options!
10
+ @by_star_start_field ||= args[0]
11
+ @by_star_end_field ||= args[1]
12
+ @by_star_offset ||= options[:offset]
13
+ @by_star_scope ||= options[:scope]
14
+ end
15
+
16
+ def by_star_offset(options = {})
17
+ (options[:offset] || @by_star_offset || 0).seconds
18
+ end
19
+
20
+ def by_star_start_field(options={})
21
+ field = options[:field] ||
22
+ options[:start_field] ||
23
+ @by_star_start_field ||
24
+ by_star_default_field
25
+ field.to_s
26
+ end
27
+
28
+ def by_star_end_field(options={})
29
+ field = options[:field] ||
30
+ options[:end_field] ||
31
+ @by_star_end_field ||
32
+ by_star_start_field
33
+ field.to_s
34
+ end
35
+
36
+ def by_star_scope(options={})
37
+ scope = options[:scope] || @by_star_scope || self
38
+ if scope.is_a?(Proc)
39
+ if scope.arity == 0
40
+ return instance_exec(&scope)
41
+ elsif options[:scope_args]
42
+ return instance_exec(*Array(options[:scope_args]), &scope)
43
+ else
44
+ raise 'ByStar :scope Proc requires :scope_args to be specified.'
45
+ end
46
+ else
47
+ return scope
48
+ end
49
+ end
50
+
51
+ protected
52
+
53
+ # Wrapper function which extracts time and options for each by_star query.
54
+ # Note the following syntax examples are valid:
55
+ #
56
+ # Post.by_month # defaults to current time
57
+ # Post.by_month(2, year: 2004) # February, 2004
58
+ # Post.by_month(Time.now)
59
+ # Post.by_month(Time.now, field: "published_at")
60
+ # Post.by_month(field: "published_at")
61
+ #
62
+ def with_by_star_options(*args, &block)
63
+ options = args.extract_options!.symbolize_keys!
64
+ time = args.first || Time.zone.now
65
+ block.call(time, options)
66
+ end
67
+ end
68
+ end
@@ -1,120 +1,156 @@
1
- module ByStar
2
-
3
- module Between
4
-
5
- def between_times(start, finish, options={})
6
- offset = by_star_offset(options)
7
- between_times_query(start + offset, finish + offset, options)
8
- end
9
-
10
- def by_day(*args)
11
- with_by_star_options(*args) do |time, options|
12
- time = ByStar::Normalization.time(time)
13
- between_times(time.beginning_of_day, time.end_of_day, options)
14
- end
15
- end
16
-
17
- def by_week(*args)
18
- with_by_star_options(*args) do |time, options|
19
- time = ByStar::Normalization.week(time, options)
20
- start_day = Array(options[:start_day])
21
- between_times(time.beginning_of_week(*start_day), time.end_of_week(*start_day), options)
22
- end
23
- end
24
-
25
- def by_weekend(*args)
26
- with_by_star_options(*args) do |time, options|
27
- time = ByStar::Normalization.week(time, options)
28
- between_times(time.beginning_of_weekend, time.end_of_weekend, options)
29
- end
30
- end
31
-
32
- def by_fortnight(*args)
33
- with_by_star_options(*args) do |time, options|
34
- time = ByStar::Normalization.fortnight(time, options)
35
- between_times(time.beginning_of_fortnight, time.end_of_fortnight, options)
36
- end
37
- end
38
-
39
- def by_month(*args)
40
- with_by_star_options(*args) do |time, options|
41
- time = ByStar::Normalization.month(time, options)
42
- between_times(time.beginning_of_month, time.end_of_month, options)
43
- end
44
- end
45
-
46
- def by_calendar_month(*args)
47
- with_by_star_options(*args) do |time, options|
48
- time = ByStar::Normalization.month(time, options)
49
- start_day = Array(options[:start_day])
50
- between_times(time.beginning_of_calendar_month(*start_day), time.end_of_calendar_month(*start_day), options)
51
- end
52
- end
53
-
54
- def by_quarter(*args)
55
- with_by_star_options(*args) do |time, options|
56
- time = ByStar::Normalization.quarter(time, options)
57
- between_times(time.beginning_of_quarter, time.end_of_quarter, options)
58
- end
59
- end
60
-
61
- def by_year(*args)
62
- with_by_star_options(*args) do |time, options|
63
- time = ByStar::Normalization.year(time, options)
64
- between_times(time.beginning_of_year, time.end_of_year, options)
65
- end
66
- end
67
-
68
- def today(options={})
69
- by_day(Time.zone.now, options)
70
- end
71
-
72
- def yesterday(options={})
73
- by_day(Time.zone.now.yesterday, options)
74
- end
75
-
76
- def tomorrow(options={})
77
- by_day(Time.zone.now.tomorrow, options)
78
- end
79
-
80
- def past_day(options={})
81
- between_times(Time.zone.now - 1.day, Time.zone.now, options)
82
- end
83
-
84
- def past_week(options={})
85
- between_times(Time.zone.now - 1.week, Time.zone.now, options)
86
- end
87
-
88
- def past_fortnight(options={})
89
- between_times(Time.zone.now - 2.weeks, Time.zone.now, options)
90
- end
91
-
92
- def past_month(options={})
93
- between_times(Time.zone.now - 1.month, Time.zone.now, options)
94
- end
95
-
96
- def past_year(options={})
97
- between_times(Time.zone.now - 1.year, Time.zone.now, options)
98
- end
99
-
100
- def next_day(options={})
101
- between_times(Time.zone.now, Time.zone.now + 1.day, options)
102
- end
103
-
104
- def next_week(options={})
105
- between_times(Time.zone.now, Time.zone.now + 1.week, options)
106
- end
107
-
108
- def next_fortnight(options={})
109
- between_times(Time.zone.now, Time.zone.now + 2.weeks, options)
110
- end
111
-
112
- def next_month(options={})
113
- between_times(Time.zone.now, Time.zone.now + 1.month, options)
114
- end
115
-
116
- def next_year(options={})
117
- between_times(Time.zone.now, Time.zone.now + 1.year, options)
118
- end
119
- end
120
- end
1
+ module ByStar
2
+
3
+ module Between
4
+
5
+ def between_times(*args)
6
+ options = args.extract_options!.symbolize_keys!
7
+
8
+ start_time, end_time = case args[0]
9
+ when Array, Range then [args[0].first, args[0].last]
10
+ else args[0..1]
11
+ end
12
+
13
+ offset = (options[:offset] || 0).seconds
14
+ start_time += offset if start_time
15
+ end_time += offset if end_time
16
+
17
+ start_field = by_star_start_field(options)
18
+ end_field = by_star_end_field(options)
19
+ scope = by_star_scope(options)
20
+
21
+ scope = if !start_time && !end_time
22
+ scope # do nothing
23
+ elsif !end_time
24
+ by_star_after_query(scope, start_field, start_time)
25
+ elsif !start_time
26
+ by_star_before_query(scope, start_field, end_time)
27
+ elsif start_field == end_field
28
+ by_star_point_query(scope, start_field, start_time, end_time)
29
+ elsif options[:strict]
30
+ by_star_span_strict_query(scope, start_field, end_field, start_time, end_time)
31
+ else
32
+ by_star_span_overlap_query(scope, start_field, end_field, start_time, end_time, options)
33
+ end
34
+
35
+ scope = by_star_order(scope, options[:order]) if options[:order]
36
+
37
+ scope
38
+ end
39
+
40
+ def by_day(*args)
41
+ with_by_star_options(*args) do |time, options|
42
+ time = ByStar::Normalization.time(time)
43
+ between_times(time.beginning_of_day, time.end_of_day, options)
44
+ end
45
+ end
46
+
47
+ def by_week(*args)
48
+ with_by_star_options(*args) do |time, options|
49
+ time = ByStar::Normalization.week(time, options)
50
+ start_day = Array(options[:start_day])
51
+ between_times(time.beginning_of_week(*start_day), time.end_of_week(*start_day), options)
52
+ end
53
+ end
54
+
55
+ def by_cweek(*args)
56
+ with_by_star_options(*args) do |time, options|
57
+ by_week(ByStar::Normalization.cweek(time, options), options)
58
+ end
59
+ end
60
+
61
+ def by_weekend(*args)
62
+ with_by_star_options(*args) do |time, options|
63
+ time = ByStar::Normalization.week(time, options)
64
+ between_times(time.beginning_of_weekend, time.end_of_weekend, options)
65
+ end
66
+ end
67
+
68
+ def by_fortnight(*args)
69
+ with_by_star_options(*args) do |time, options|
70
+ time = ByStar::Normalization.fortnight(time, options)
71
+ between_times(time.beginning_of_fortnight, time.end_of_fortnight, options)
72
+ end
73
+ end
74
+
75
+ def by_month(*args)
76
+ with_by_star_options(*args) do |time, options|
77
+ time = ByStar::Normalization.month(time, options)
78
+ between_times(time.beginning_of_month, time.end_of_month, options)
79
+ end
80
+ end
81
+
82
+ def by_calendar_month(*args)
83
+ with_by_star_options(*args) do |time, options|
84
+ time = ByStar::Normalization.month(time, options)
85
+ start_day = Array(options[:start_day])
86
+ between_times(time.beginning_of_calendar_month(*start_day), time.end_of_calendar_month(*start_day), options)
87
+ end
88
+ end
89
+
90
+ def by_quarter(*args)
91
+ with_by_star_options(*args) do |time, options|
92
+ time = ByStar::Normalization.quarter(time, options)
93
+ between_times(time.beginning_of_quarter, time.end_of_quarter, options)
94
+ end
95
+ end
96
+
97
+ def by_year(*args)
98
+ with_by_star_options(*args) do |time, options|
99
+ time = ByStar::Normalization.year(time, options)
100
+ between_times(time.beginning_of_year, time.end_of_year, options)
101
+ end
102
+ end
103
+
104
+ def today(options={})
105
+ by_day(Time.zone.now, options)
106
+ end
107
+
108
+ def yesterday(options={})
109
+ by_day(Time.zone.now.yesterday, options)
110
+ end
111
+
112
+ def tomorrow(options={})
113
+ by_day(Time.zone.now.tomorrow, options)
114
+ end
115
+
116
+ def past_day(options={})
117
+ between_times(Time.zone.now - 1.day, Time.zone.now, options)
118
+ end
119
+
120
+ def past_week(options={})
121
+ between_times(Time.zone.now - 1.week, Time.zone.now, options)
122
+ end
123
+
124
+ def past_fortnight(options={})
125
+ between_times(Time.zone.now - 2.weeks, Time.zone.now, options)
126
+ end
127
+
128
+ def past_month(options={})
129
+ between_times(Time.zone.now - 1.month, Time.zone.now, options)
130
+ end
131
+
132
+ def past_year(options={})
133
+ between_times(Time.zone.now - 1.year, Time.zone.now, options)
134
+ end
135
+
136
+ def next_day(options={})
137
+ between_times(Time.zone.now, Time.zone.now + 1.day, options)
138
+ end
139
+
140
+ def next_week(options={})
141
+ between_times(Time.zone.now, Time.zone.now + 1.week, options)
142
+ end
143
+
144
+ def next_fortnight(options={})
145
+ between_times(Time.zone.now, Time.zone.now + 2.weeks, options)
146
+ end
147
+
148
+ def next_month(options={})
149
+ between_times(Time.zone.now, Time.zone.now + 1.month, options)
150
+ end
151
+
152
+ def next_year(options={})
153
+ between_times(Time.zone.now, Time.zone.now + 1.year, options)
154
+ end
155
+ end
156
+ end