fixup json time format

improve_associations
Chris Anderson 2009-01-13 20:08:58 -08:00
parent cc5cf62cc4
commit a4144af72d
2 changed files with 1 additions and 35 deletions

View File

@ -46,40 +46,6 @@ task :gemspec do
end
end
# desc "Update Github Gemspec"
# task :gemspec do
# skip_fields = %w(new_platform original_platform)
# integer_fields = %w(specification_version)
#
# result = "Gem::Specification.new do |s|\n"
# spec.instance_variables.each do |ivar|
# value = spec.instance_variable_get(ivar)
# name = ivar.split("@").last
# next if skip_fields.include?(name) || value.nil? || value == "" || (value.respond_to?(:empty?) && value.empty?)
# if name == "dependencies"
# value.each do |d|
# dep, *ver = d.to_s.split(" ")
# result << " s.add_dependency #{dep.inspect}, [#{ /\(([^\,]*)/ . match(ver.join(" "))[1].inspect}]\n"
# end
# else
# case value
# when Array
# value = name != "files" ? value.inspect : value.inspect.split(",").join(",\n")
# when Fixnum
# # leave as-is
# when String
# value = value.to_i if integer_fields.include?(name)
# value = value.inspect
# else
# value = value.to_s.inspect
# end
# result << " s.#{name} = #{value}\n"
# end
# end
# result << "end"
# File.open(File.join(File.dirname(__FILE__), "#{spec.name}.gemspec"), "w"){|f| f << result}
# end
desc "Run all specs"
Spec::Rake::SpecTask.new('spec') do |t|
t.spec_files = FileList['spec/**/*_spec.rb']

View File

@ -8,7 +8,7 @@ class Time
def to_json(options = nil)
u = self.utc
%("#{u.strftime("%Y/%m/%d %H:%M:%S.#{u.usec} +0000")}")
%("#{u.strftime("%Y/%m/%d %H:%M:%S +0000")}")
end
# Decodes the JSON time format to a UTC time.