blob: 7b5269edf578f2b3fa2b20813945d8785e5a158c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
require 'stringio'
module Psych
module Nodes
###
# The base class for any Node in a YAML parse tree. This class should
# never be instantiated.
class Node
include Psych::Visitable
attr_reader :children
attr_reader :tag
def initialize
@children = []
end
def to_ruby
Visitors::ToRuby.new.accept self
end
alias :transform :to_ruby
def to_yaml
io = StringIO.new
Visitors::Emitter.new(io).accept self
io.string
end
end
end
end
|