timeframe 0.2.0 → 0.2.1

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/.gitignore CHANGED
@@ -21,3 +21,4 @@ pkg
21
21
 
22
22
  ## PROJECT::SPECIFIC
23
23
  Gemfile.lock
24
+ *.gem
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 0.2.1 / 2012-04-24
2
+
3
+ * Bug fixes
4
+
5
+ * Stop defining Timeframe#to_json... it's conventional to only define #as_json
6
+
1
7
  0.2.0 / 2012-04-24
2
8
 
3
9
  * Breaking changes
data/lib/timeframe.rb CHANGED
@@ -278,10 +278,6 @@ class Timeframe
278
278
  self.class.new((start_date - 1.year), (end_date - 1.year))
279
279
  end
280
280
 
281
- def to_json(*)
282
- iso8601
283
- end
284
-
285
281
  def as_json(*)
286
282
  iso8601
287
283
  end
@@ -1,3 +1,3 @@
1
1
  class Timeframe
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
@@ -275,7 +275,7 @@ describe Timeframe do
275
275
  end
276
276
  it 'understands JSON' do
277
277
  json =<<-EOS
278
- 2009-05-01/2009-06-01
278
+ "2009-05-01/2009-06-01"
279
279
  EOS
280
280
  Timeframe.parse(json).must_equal Timeframe.new(:year => 2009, :month => 5)
281
281
  end
@@ -286,13 +286,14 @@ EOS
286
286
  end
287
287
  end
288
288
 
289
- describe '#to_json' do
289
+ describe '#as_json' do
290
290
  it 'should generate JSON (test fails on ruby 1.8)' do
291
- Timeframe.new(:year => 2009).to_json.must_equal %{2009-01-01/2010-01-01}
291
+ Timeframe.new(:year => 2009).as_json.must_equal %{2009-01-01/2010-01-01}
292
+ MultiJson.dump(Timeframe.new(:year => 2009)).must_equal Timeframe.new(:year => 2009).as_json.inspect
292
293
  end
293
- it 'understands its own #to_json' do
294
+ it 'understands its own JSON' do
294
295
  t = Timeframe.new(:year => 2009, :month => 5)
295
- Timeframe.from_json(t.to_json).must_equal t
296
+ Timeframe.from_json(MultiJson.dump(t)).must_equal t
296
297
  end
297
298
  end
298
299
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timeframe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: