Class: Psych::Nodes::Node
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
Enumerable
|
|
Inherits: | Object |
Defined in: | ext/psych/lib/psych/nodes/node.rb |
Overview
The base class for any Node
in a YAML parse tree. This class should never be instantiated.
Class Method Summary
-
.new ⇒ Node
constructor
Create a new
Node
Instance Attribute Summary
- #alias? ⇒ Boolean readonly
-
#children
readonly
The children of this node.
- #document? ⇒ Boolean readonly
-
#end_column
rw
The column number where this node ends.
-
#end_line
rw
The line number where this node ends.
- #mapping? ⇒ Boolean readonly
- #scalar? ⇒ Boolean readonly
- #sequence? ⇒ Boolean readonly
-
#start_column
rw
The column number where this node start.
-
#start_line
rw
The line number where this node start.
- #stream? ⇒ Boolean readonly
-
#tag
readonly
An associated tag.
Instance Method Summary
-
#each(&block)
Iterate over each node in the tree.
-
#to_ruby(symbolize_names: false, freeze: false, strict_integer: false)
(also: #transform)
Convert this node to Ruby.
- #to_yaml(io = nil, options = {})
- #transform(symbolize_names: false, freeze: false, strict_integer: false)
-
#yaml(io = nil, options = {})
(also: #to_yaml)
Convert this node to YAML.
Constructor Details
.new ⇒ Node
Create a new Node
# File 'ext/psych/lib/psych/nodes/node.rb', line 33
def initialize @children = [] end
Instance Attribute Details
#alias? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'ext/psych/lib/psych/nodes/node.rb', line 67
def alias?; false; end
#children (readonly)
The children of this node
# File 'ext/psych/lib/psych/nodes/node.rb', line 15
attr_reader :children
#document? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'ext/psych/lib/psych/nodes/node.rb', line 68
def document?; false; end
#end_column (rw)
The column number where this node ends
# File 'ext/psych/lib/psych/nodes/node.rb', line 30
attr_accessor :end_column
#end_line (rw)
The line number where this node ends
# File 'ext/psych/lib/psych/nodes/node.rb', line 27
attr_accessor :end_line
#mapping? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'ext/psych/lib/psych/nodes/node.rb', line 69
def mapping?; false; end
#scalar? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'ext/psych/lib/psych/nodes/node.rb', line 70
def scalar?; false; end
#sequence? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'ext/psych/lib/psych/nodes/node.rb', line 71
def sequence?; false; end
#start_column (rw)
The column number where this node start
# File 'ext/psych/lib/psych/nodes/node.rb', line 24
attr_accessor :start_column
#start_line (rw)
The line number where this node start
# File 'ext/psych/lib/psych/nodes/node.rb', line 21
attr_accessor :start_line
#stream? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'ext/psych/lib/psych/nodes/node.rb', line 72
def stream?; false; end
#tag (readonly)
An associated tag
# File 'ext/psych/lib/psych/nodes/node.rb', line 18
attr_reader :tag
Instance Method Details
#each(&block)
Iterate over each node in the tree. Yields each node to block
depth first.
# File 'ext/psych/lib/psych/nodes/node.rb', line 40
def each &block return enum_for :each unless block_given? Visitors::DepthFirst.new(block).accept self end
#to_ruby(symbolize_names: false, freeze: false, strict_integer: false) Also known as: #transform
Convert this node to Ruby.
See also ::Psych::Visitors::ToRuby
#to_yaml(io = nil, options = {})
[ GitHub ]# File 'ext/psych/lib/psych/nodes/node.rb', line 65
alias :to_yaml :yaml
#transform(symbolize_names: false, freeze: false, strict_integer: false)
[ GitHub ]# File 'ext/psych/lib/psych/nodes/node.rb', line 52
alias :transform :to_ruby
#yaml(io = nil, options = {}) Also known as: #to_yaml
Convert this node to YAML.
See also ::Psych::Visitors::Emitter