summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2009-10-06 16:50:50 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2009-10-06 16:50:50 -0700
commitbec41aa80d5977c3f9315e3761f4d364d311960d (patch)
treeca9da1b7aa915cbe21837a80ef20269c031e0944 /lib
parent4d48bff3590440b1bc35daf511efb216258b87d0 (diff)
downloadpsych-bec41aa80d5977c3f9315e3761f4d364d311960d.zip
emitting dates
Diffstat (limited to 'lib')
-rw-r--r--lib/psych/ruby.rb4
-rw-r--r--lib/psych/visitors/yast_builder.rb4
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/psych/ruby.rb b/lib/psych/ruby.rb
index e68632b..6258e81 100644
--- a/lib/psych/ruby.rb
+++ b/lib/psych/ruby.rb
@@ -1,14 +1,14 @@
require 'complex'
require 'rational'
+require 'date'
[
Object, String, Class, Hash, Array, NilClass, Float,
- FalseClass, TrueClass, Range, Complex, Rational
+ FalseClass, TrueClass, Range, Complex, Rational, Date
# Struct
# Exception
# Regexp
# Time
- # Date
].each do |klass|
klass.send(:remove_method, :to_yaml) rescue NameError
end
diff --git a/lib/psych/visitors/yast_builder.rb b/lib/psych/visitors/yast_builder.rb
index c0396e2..9111f8b 100644
--- a/lib/psych/visitors/yast_builder.rb
+++ b/lib/psych/visitors/yast_builder.rb
@@ -21,6 +21,10 @@ module Psych
raise TypeError, "Can't dump #{target.class}"
end
+ def visit_Date o
+ append Nodes::Scalar.new o.to_s
+ end
+
def visit_Rational o
@stack.push append Nodes::Mapping.new(nil,'!ruby/object:Rational',false)
['denominator', o.denominator, 'numerator', o.numerator].each do |m|