summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2009-09-28 22:02:10 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2009-09-28 22:02:10 -0700
commit0f174ee584cd1755819becf1da74e0c010049542 (patch)
tree906eb279f6adc666673c8068da335ff01b822708 /lib
parent780b789a2fb985ac8ae24eab21eb939293524542 (diff)
downloadpsych-0f174ee584cd1755819becf1da74e0c010049542.zip
scalars converted to yaml
Diffstat (limited to 'lib')
-rw-r--r--lib/psych/nodes/document.rb2
-rw-r--r--lib/psych/tree_builder.rb5
-rw-r--r--lib/psych/visitors/emitter.rb4
3 files changed, 5 insertions, 6 deletions
diff --git a/lib/psych/nodes/document.rb b/lib/psych/nodes/document.rb
index 0bd58b2..be786c6 100644
--- a/lib/psych/nodes/document.rb
+++ b/lib/psych/nodes/document.rb
@@ -10,7 +10,7 @@ module Psych
# Was this document implicitly created?
attr_accessor :implicit
- def initialize version = [], tag_directives = [], implicit = true
+ def initialize version = [], tag_directives = [], implicit = false
super()
@version = version
@tag_directives = tag_directives
diff --git a/lib/psych/tree_builder.rb b/lib/psych/tree_builder.rb
index c158368..efbeaf9 100644
--- a/lib/psych/tree_builder.rb
+++ b/lib/psych/tree_builder.rb
@@ -23,31 +23,26 @@ module Psych
}.each do |node|
class_eval %{
def start_#{node.downcase}(*args)
- super
n = Nodes::#{node}.new(*args)
@stack.last.children << n
@stack.push n
end
def end_#{node.downcase}(*args)
- super
@stack.pop
end
}
end
def start_stream encoding
- super
@stack.push Nodes::Stream.new(encoding)
end
def scalar(*args)
- super
@stack.last.children << Nodes::Scalar.new(*args)
end
def alias(*args)
- super
@stack.last.children << Nodes::Alias.new(*args)
end
end
diff --git a/lib/psych/visitors/emitter.rb b/lib/psych/visitors/emitter.rb
index d71ce2a..e2dd0be 100644
--- a/lib/psych/visitors/emitter.rb
+++ b/lib/psych/visitors/emitter.rb
@@ -16,6 +16,10 @@ module Psych
o.children.each { |c| c.accept self }
@handler.end_document o.implicit
end
+
+ visitor_for(Nodes::Scalar) do |o|
+ @handler.scalar o.value, o.anchor, o.tag, o.plain, o.quoted, o.style
+ end
end
end
end