Class: Psych::Nodes::Sequence
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Node
|
|
Instance Chain:
self,
Node ,
Enumerable
|
|
Inherits: |
Psych::Nodes::Node
|
Defined in: | ext/psych/lib/psych/nodes/sequence.rb |
Overview
This class represents a YAML sequence.
A YAML sequence is basically a list, and looks like this:
%YAML 1.1
---
- I am
- a Sequence
A YAML sequence may have an anchor like this:
%YAML 1.1
---
&A [
"This sequence",
"has an anchor"
]
A YAML sequence may also have a tag like this:
%YAML 1.1
---
!!seq [
"This sequence",
"has a tag"
]
This class represents a sequence in a YAML document. A Sequence
node may have 0 or more children. Valid children for this node are:
Constant Summary
-
ANY =
Any Styles, emitter chooses
0
-
BLOCK =
Block style sequence
1
-
FLOW =
Flow style sequence
2
Class Method Summary
-
.new(anchor = nil, tag = nil, implicit = true, style = BLOCK) ⇒ Sequence
constructor
Create a new object representing a YAML sequence.
Node
- Inherited
Instance Attribute Summary
-
#anchor
rw
The anchor for this sequence (if any).
-
#implicit
rw
Is this sequence started implicitly?
- #sequence? ⇒ Boolean readonly
-
#style
rw
The sequence style used.
-
#tag
rw
The tag name for this sequence (if any).
Node
- Inherited
#alias?, | |
#children | The children of this node. |
#document?, | |
#end_column | The column number where this node ends. |
#end_line | The line number where this node ends. |
#mapping?, #scalar?, #sequence?, | |
#start_column | The column number where this node start. |
#start_line | The line number where this node start. |
#stream?, | |
#tag | An associated tag. |
Instance Method Summary
Node
- Inherited
#each | Iterate over each node in the tree. |
#to_ruby | Convert this node to Ruby. |
#to_yaml | |
#transform |
|
#yaml | Convert this node to YAML. |
Constructor Details
.new(anchor = nil, tag = nil, implicit = true, style = BLOCK) ⇒ Sequence
Instance Attribute Details
#anchor (rw)
The anchor for this sequence (if any)
# File 'ext/psych/lib/psych/nodes/sequence.rb', line 52
attr_accessor :anchor
#implicit (rw)
Is this sequence started implicitly?
# File 'ext/psych/lib/psych/nodes/sequence.rb', line 58
attr_accessor :implicit
#sequence? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'ext/psych/lib/psych/nodes/sequence.rb', line 81
def sequence?; true; end
#style (rw)
The sequence style used
# File 'ext/psych/lib/psych/nodes/sequence.rb', line 61
attr_accessor :style
#tag (rw)
The tag name for this sequence (if any)
# File 'ext/psych/lib/psych/nodes/sequence.rb', line 55
attr_accessor :tag