timeframe 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/timeframe/version.rb +1 -1
- data/lib/timeframe.rb +6 -6
- data/spec/timeframe_spec.rb +1 -6
- metadata +2 -27
data/lib/timeframe/version.rb
CHANGED
data/lib/timeframe.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'date'
|
2
2
|
require 'active_support/version'
|
3
3
|
%w{
|
4
|
+
active_support/core_ext/hash
|
4
5
|
active_support/core_ext/array/extract_options
|
5
6
|
active_support/core_ext/string/conversions
|
6
7
|
active_support/core_ext/date/conversions
|
7
8
|
active_support/core_ext/integer/time
|
8
9
|
active_support/core_ext/numeric/time
|
10
|
+
active_support/json
|
9
11
|
}.each do |active_support_3_requirement|
|
10
12
|
require active_support_3_requirement
|
11
13
|
end if ActiveSupport::VERSION::MAJOR == 3
|
@@ -245,15 +247,13 @@ class Timeframe
|
|
245
247
|
def last_year
|
246
248
|
self.class.new((from - 1.year), (to - 1.year))
|
247
249
|
end
|
248
|
-
|
249
|
-
|
250
|
-
def to_json(*)
|
250
|
+
|
251
|
+
def as_json(*)
|
251
252
|
to_param
|
252
253
|
end
|
253
254
|
|
254
|
-
#
|
255
|
-
|
256
|
-
def as_json(*)
|
255
|
+
# overriding this so that as_json is not used
|
256
|
+
def to_json(*)
|
257
257
|
to_param
|
258
258
|
end
|
259
259
|
|
data/spec/timeframe_spec.rb
CHANGED
@@ -262,14 +262,9 @@ describe Timeframe do
|
|
262
262
|
end
|
263
263
|
|
264
264
|
describe '#to_json' do
|
265
|
-
it 'should generate JSON' do
|
265
|
+
it 'should generate JSON (test fails on ruby 1.8)' do
|
266
266
|
Timeframe.new(:year => 2009).to_json.should == "2009-01-01/2010-01-01"
|
267
267
|
end
|
268
|
-
it 'should ignore any arguments you give it' do
|
269
|
-
example = Timeframe.new(:year => 2009).to_json
|
270
|
-
Timeframe.new(:year => 2009).to_json('hi').should == example
|
271
|
-
Timeframe.new(:year => 2009).to_json('hi', 'there').should == example
|
272
|
-
end
|
273
268
|
end
|
274
269
|
|
275
270
|
describe '#to_param' do
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timeframe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 13
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 9
|
10
|
-
version: 0.0.9
|
5
|
+
version: 0.0.10
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Andy Rossmeissl
|
@@ -17,7 +12,7 @@ autorequire:
|
|
17
12
|
bindir: bin
|
18
13
|
cert_chain: []
|
19
14
|
|
20
|
-
date: 2011-04-
|
15
|
+
date: 2011-04-22 00:00:00 -05:00
|
21
16
|
default_executable:
|
22
17
|
dependencies:
|
23
18
|
- !ruby/object:Gem::Dependency
|
@@ -28,9 +23,6 @@ dependencies:
|
|
28
23
|
requirements:
|
29
24
|
- - ~>
|
30
25
|
- !ruby/object:Gem::Version
|
31
|
-
hash: 1
|
32
|
-
segments:
|
33
|
-
- 1
|
34
26
|
version: "1"
|
35
27
|
type: :development
|
36
28
|
version_requirements: *id001
|
@@ -42,9 +34,6 @@ dependencies:
|
|
42
34
|
requirements:
|
43
35
|
- - ">="
|
44
36
|
- !ruby/object:Gem::Version
|
45
|
-
hash: 3
|
46
|
-
segments:
|
47
|
-
- 0
|
48
37
|
version: "0"
|
49
38
|
type: :development
|
50
39
|
version_requirements: *id002
|
@@ -56,11 +45,6 @@ dependencies:
|
|
56
45
|
requirements:
|
57
46
|
- - ">="
|
58
47
|
- !ruby/object:Gem::Version
|
59
|
-
hash: 9
|
60
|
-
segments:
|
61
|
-
- 2
|
62
|
-
- 3
|
63
|
-
- 5
|
64
48
|
version: 2.3.5
|
65
49
|
type: :runtime
|
66
50
|
version_requirements: *id003
|
@@ -72,9 +56,6 @@ dependencies:
|
|
72
56
|
requirements:
|
73
57
|
- - ">="
|
74
58
|
- !ruby/object:Gem::Version
|
75
|
-
hash: 3
|
76
|
-
segments:
|
77
|
-
- 0
|
78
59
|
version: "0"
|
79
60
|
type: :runtime
|
80
61
|
version_requirements: *id004
|
@@ -114,18 +95,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
95
|
requirements:
|
115
96
|
- - ">="
|
116
97
|
- !ruby/object:Gem::Version
|
117
|
-
hash: 3
|
118
|
-
segments:
|
119
|
-
- 0
|
120
98
|
version: "0"
|
121
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
100
|
none: false
|
123
101
|
requirements:
|
124
102
|
- - ">="
|
125
103
|
- !ruby/object:Gem::Version
|
126
|
-
hash: 3
|
127
|
-
segments:
|
128
|
-
- 0
|
129
104
|
version: "0"
|
130
105
|
requirements: []
|
131
106
|
|