date_ranger 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/date_ranger.gemspec +1 -0
- data/lib/date_ranger/version.rb +1 -1
- data/lib/date_ranger.rb +5 -5
- data/spec/date_ranger_spec.rb +4 -4
- metadata +63 -58
data/date_ranger.gemspec
CHANGED
data/lib/date_ranger/version.rb
CHANGED
data/lib/date_ranger.rb
CHANGED
@@ -12,24 +12,24 @@ module DateRanger
|
|
12
12
|
|
13
13
|
def start_date
|
14
14
|
@start_date ||= self.date_ranger_options[:default_start_date].call
|
15
|
-
@start_date = case self.date_ranger_options[:timestep]
|
16
|
-
when :daily; @start_date
|
17
|
-
when :monthly; @start_date.beginning_of_month
|
18
|
-
end
|
19
15
|
@start_date = if @start_date.respond_to?(:to_date)
|
20
16
|
@start_date.to_date
|
21
17
|
else
|
22
18
|
@start_date
|
23
19
|
end
|
20
|
+
@start_date = case self.date_ranger_options[:timestep]
|
21
|
+
when :daily; @start_date
|
22
|
+
when :monthly; @start_date.beginning_of_month
|
23
|
+
end
|
24
24
|
end
|
25
25
|
|
26
26
|
def end_date
|
27
27
|
@end_date ||= self.date_ranger_options[:default_end_date].call
|
28
|
+
@end_date = @end_date.respond_to?(:to_date) ? @end_date.to_date : @end_date
|
28
29
|
@end_date = case self.date_ranger_options[:timestep]
|
29
30
|
when :daily; @end_date
|
30
31
|
when :monthly; @end_date.end_of_month
|
31
32
|
end
|
32
|
-
@end_date = @end_date.respond_to?(:to_date) ? @end_date.to_date : @end_date
|
33
33
|
end
|
34
34
|
|
35
35
|
end
|
data/spec/date_ranger_spec.rb
CHANGED
@@ -54,7 +54,7 @@ describe DateRanger do
|
|
54
54
|
it 'should start at the first day of the month' do
|
55
55
|
Something.has_date_range(:timestep => :monthly)
|
56
56
|
something = Something.new
|
57
|
-
something.start_date = '2012-01-05'
|
57
|
+
something.start_date = '2012-01-05'
|
58
58
|
something.start_date.should == '2012-01-01'.to_date
|
59
59
|
end
|
60
60
|
end
|
@@ -63,7 +63,7 @@ describe DateRanger do
|
|
63
63
|
it 'should end at the given date' do
|
64
64
|
Something.has_date_range(:timestep => :daily)
|
65
65
|
something = Something.new
|
66
|
-
something.start_date = '2012-01-15'
|
66
|
+
something.start_date = '2012-01-15'
|
67
67
|
something.start_date.should == '2012-01-15'.to_date
|
68
68
|
end
|
69
69
|
end
|
@@ -96,7 +96,7 @@ describe DateRanger do
|
|
96
96
|
it 'should end at the last day of the month' do
|
97
97
|
Something.has_date_range(:timestep => :monthly)
|
98
98
|
something = Something.new
|
99
|
-
something.end_date = '2012-01-15'
|
99
|
+
something.end_date = '2012-01-15'
|
100
100
|
something.end_date.should == '2012-01-31'.to_date
|
101
101
|
end
|
102
102
|
end
|
@@ -105,7 +105,7 @@ describe DateRanger do
|
|
105
105
|
it 'should end at the given date' do
|
106
106
|
Something.has_date_range(:timestep => :daily)
|
107
107
|
something = Something.new
|
108
|
-
something.end_date = '2012-01-15'
|
108
|
+
something.end_date = '2012-01-15'
|
109
109
|
something.end_date.should == '2012-01-15'.to_date
|
110
110
|
end
|
111
111
|
end
|
metadata
CHANGED
@@ -1,64 +1,72 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: date_ranger
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
version: 0.0.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Nestor Pestelos and Ramon Tayag
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-12-14 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.12.0
|
22
|
+
type: :development
|
22
23
|
prerelease: false
|
23
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
25
|
none: false
|
25
|
-
requirements:
|
26
|
+
requirements:
|
26
27
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 63
|
29
|
-
segments:
|
30
|
-
- 2
|
31
|
-
- 12
|
32
|
-
- 0
|
28
|
+
- !ruby/object:Gem::Version
|
33
29
|
version: 2.12.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
34
38
|
type: :development
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: activesupport
|
38
39
|
prerelease: false
|
39
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
41
|
none: false
|
41
|
-
requirements:
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: activesupport
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
42
51
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 3
|
47
|
-
- 0
|
48
|
-
version: "3.0"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.0'
|
49
54
|
type: :runtime
|
50
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
51
62
|
description: Provides date range methods
|
52
|
-
email:
|
63
|
+
email:
|
53
64
|
- ngpestelos@gmail.com
|
54
65
|
- ramon.tayag@gmail.com
|
55
66
|
executables: []
|
56
|
-
|
57
67
|
extensions: []
|
58
|
-
|
59
68
|
extra_rdoc_files: []
|
60
|
-
|
61
|
-
files:
|
69
|
+
files:
|
62
70
|
- .gitignore
|
63
71
|
- Gemfile
|
64
72
|
- LICENSE
|
@@ -70,39 +78,36 @@ files:
|
|
70
78
|
- lib/date_ranger/version.rb
|
71
79
|
- spec/date_ranger_spec.rb
|
72
80
|
- spec/spec_helper.rb
|
73
|
-
homepage:
|
81
|
+
homepage: ''
|
74
82
|
licenses: []
|
75
|
-
|
76
83
|
post_install_message:
|
77
84
|
rdoc_options: []
|
78
|
-
|
79
|
-
require_paths:
|
85
|
+
require_paths:
|
80
86
|
- lib
|
81
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
88
|
none: false
|
83
|
-
requirements:
|
84
|
-
- -
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
|
87
|
-
segments:
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
segments:
|
88
94
|
- 0
|
89
|
-
|
90
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
hash: -793220054918885389
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
97
|
none: false
|
92
|
-
requirements:
|
93
|
-
- -
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
|
96
|
-
segments:
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
segments:
|
97
103
|
- 0
|
98
|
-
|
104
|
+
hash: -793220054918885389
|
99
105
|
requirements: []
|
100
|
-
|
101
106
|
rubyforge_project:
|
102
107
|
rubygems_version: 1.8.24
|
103
108
|
signing_key:
|
104
109
|
specification_version: 3
|
105
110
|
summary: Provides date range methods
|
106
|
-
test_files:
|
111
|
+
test_files:
|
107
112
|
- spec/date_ranger_spec.rb
|
108
113
|
- spec/spec_helper.rb
|