Permalink
Browse files

use own constant instead of relying on 3rd party

  • Loading branch information...
1 parent 981410c commit 4589cf135e8001341c5247b6c3104728ccdc1bff @mkristian committed Dec 7, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/ixtlan/babel/factory.rb
@@ -2,6 +2,8 @@ module Ixtlan
module Babel
class Factory
+ NANOSECONDS_IN_DAY = Rational(1, 86400*10**9)
+
class EmptyArraySerializer < Array
def use(arg)
self
@@ -11,7 +13,7 @@ def use(arg)
def initialize(custom_serializers = {})
@map = {}
add('DateTime') do |dt|
- dt.strftime('%Y-%m-%dT%H:%M:%S.') + ("%06d" % (dt.sec_fraction / Date::NANOSECONDS_IN_DAY / 1000)) + dt.strftime('%z')
+ dt.strftime('%Y-%m-%dT%H:%M:%S.') + ("%06d" % (dt.sec_fraction / NANOSECONDS_IN_DAY / 1000)) + dt.strftime('%z')
end
add('ActiveSupport::TimeWithZone') do |tz|
tz.strftime('%Y-%m-%dT%H:%M:%S.') + ("%06d" % tz.usec) + tz.strftime('%z')

0 comments on commit 4589cf1

Please sign in to comment.