The base class for any Node in a YAML parse tree. This class should never be instantiated.
Methods
Included Modules
Attributes
| [R] | children | The children of this node |
| [R] | tag | An associated tag |
Class Public methods
new()
Link
Create a new Psych::Nodes::Node
Source: show
# File ext/psych/lib/psych/nodes/node.rb, line 20 def initialize @children = [] end
Instance Public methods
each(&block)
Link
Iterate over each node in the tree. Yields each node to block
depth first.
Source: show
# File ext/psych/lib/psych/nodes/node.rb, line 27 def each &block return enum_for :each unless block_given? Visitors::DepthFirst.new(block).accept self end
to_ruby()
Link
Convert this node to Ruby.
See also Psych::Visitors::ToRuby
Also aliased as: transform
Source: show
# File ext/psych/lib/psych/nodes/node.rb, line 36 def to_ruby Visitors::ToRuby.create.accept(self) end
yaml(io = nil, options = {})
Link
Convert this node to YAML.
See also Psych::Visitors::Emitter
Also aliased as: to_yaml
Source: show
# File ext/psych/lib/psych/nodes/node.rb, line 45 def yaml io = nil, options = {} real_io = io || StringIO.new(''.encode('utf-8')) Visitors::Emitter.new(real_io, options).accept self return real_io.string unless io io end