georgepalmer-couch_foo 0.7.13 → 0.7.14

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/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 7
4
- :patch: 13
4
+ :patch: 14
@@ -2,6 +2,7 @@ module CouchFoo
2
2
  module AttributeMethods
3
3
  DEFAULT_SUFFIXES = %w(= ? _before_type_cast)
4
4
  ATTRIBUTE_TYPES_CACHED_BY_DEFAULT = [Time, DateTime, Date]
5
+ JSON_DATETIME_FORMAT = "%Y/%m/%d %H:%M:%S +0000"
5
6
 
6
7
  def self.included(base)
7
8
  base.extend ClassMethods
@@ -264,11 +265,11 @@ module CouchFoo
264
265
  when "Float"
265
266
  value.to_f
266
267
  when "DateTime"
267
- DateTime.parse(value.to_s).strftime("%Y/%m/%d %H:%M:%S +0000")
268
+ DateTime.parse(value.to_s).strftime(JSON_DATETIME_FORMAT)
268
269
  when "Time"
269
- Time.at(value.to_f).strftime("%Y/%m/%d %H:%M:%S +0000")
270
+ Time.at(value.to_f).strftime(JSON_DATETIME_FORMAT)
270
271
  when "Date"
271
- Date.new(value.year, value.month, value.day).strftime("%Y/%m/%d %H:%M:%S +0000")
272
+ Date.new(value.year, value.month, value.day).strftime(JSON_DATETIME_FORMAT)
272
273
  when "TrueClass"
273
274
  convert_boolean(value)
274
275
  when "Boolean"
@@ -67,7 +67,6 @@ module CouchFoo #:nodoc:
67
67
 
68
68
  class JsonSerializer < CouchFoo::Serialization::Serializer #:nodoc:
69
69
  def serialize
70
- puts serializable_record.inspect
71
70
  serializable_record.to_json
72
71
  end
73
72
  end
@@ -332,6 +332,8 @@ module CouchFoo #:nodoc:
332
332
  value.to_xml unless value.nil?
333
333
  elsif formatter = Hash::XML_FORMATTING[type.to_s]
334
334
  value ? formatter.call(value) : nil
335
+ elsif type == DateTime || type == Time
336
+ value.strftime(CouchFoo::AttributeMethods::JSON_DATETIME_FORMAT)
335
337
  else
336
338
  value
337
339
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: georgepalmer-couch_foo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.13
4
+ version: 0.7.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - George Palmer
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-18 00:00:00 -08:00
12
+ date: 2009-03-02 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency