Class: Psych::Nodes::Scalar
Overview
This class represents a YAML Scalar.
This node type is a terminal node and should not have any children.
Constant Summary collapse
- ANY =
Any style scalar, the emitter chooses
0
- PLAIN =
Plain scalar style
1
- SINGLE_QUOTED =
Single quoted style
2
- DOUBLE_QUOTED =
Double quoted style
3
- LITERAL =
Literal style
4
- FOLDED =
Folded style
5
Instance Attribute Summary collapse
-
#anchor ⇒ Object
The anchor value (if there is one).
-
#plain ⇒ Object
Is this a plain scalar?.
-
#quoted ⇒ Object
Is this scalar quoted?.
-
#style ⇒ Object
The style of this scalar.
-
#tag ⇒ Object
The tag value (if there is one).
-
#value ⇒ Object
The scalar value.
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(value, anchor = nil, tag = nil, plain = true, quoted = false, style = ANY) ⇒ Scalar
constructor
Create a new Psych::Nodes::Scalar object.
Methods inherited from Node
Constructor Details
#initialize(value, anchor = nil, tag = nil, plain = true, quoted = false, style = ANY) ⇒ Scalar
Create a new Psych::Nodes::Scalar object.
value
is the string value of the scalar anchor
is an associated anchor or nil tag
is an associated tag or nil plain
is a boolean value quoted
is a boolean value style
is an integer idicating the string style
See Also
See also Psych::Handler#scalar
57 58 59 60 61 62 63 64 |
# File 'lib/psych/nodes/scalar.rb', line 57 def initialize value, anchor = nil, tag = nil, plain = true, quoted = false, style = ANY @value = value @anchor = anchor @tag = tag @plain = plain @quoted = quoted @style = style end |
Instance Attribute Details
#anchor ⇒ Object
The anchor value (if there is one)
30 31 32 |
# File 'lib/psych/nodes/scalar.rb', line 30 def anchor @anchor end |
#plain ⇒ Object
Is this a plain scalar?
36 37 38 |
# File 'lib/psych/nodes/scalar.rb', line 36 def plain @plain end |
#quoted ⇒ Object
Is this scalar quoted?
39 40 41 |
# File 'lib/psych/nodes/scalar.rb', line 39 def quoted @quoted end |
#style ⇒ Object
The style of this scalar
42 43 44 |
# File 'lib/psych/nodes/scalar.rb', line 42 def style @style end |
#tag ⇒ Object
The tag value (if there is one)
33 34 35 |
# File 'lib/psych/nodes/scalar.rb', line 33 def tag @tag end |
#value ⇒ Object
The scalar value
27 28 29 |
# File 'lib/psych/nodes/scalar.rb', line 27 def value @value end |