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
#children, #end_column, #end_line, #start_column, #start_line
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.
- #scalar? ⇒ Boolean
Methods inherited from Node
#alias?, #document?, #each, #mapping?, #sequence?, #stream?, #to_ruby, #yaml
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 indicating the string style
See Also
See also Psych::Handler#scalar
58 59 60 61 62 63 64 65 |
# File 'lib/psych/nodes/scalar.rb', line 58 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)
31 32 33 |
# File 'lib/psych/nodes/scalar.rb', line 31 def anchor @anchor end |
#plain ⇒ Object
Is this a plain scalar?
37 38 39 |
# File 'lib/psych/nodes/scalar.rb', line 37 def plain @plain end |
#quoted ⇒ Object
Is this scalar quoted?
40 41 42 |
# File 'lib/psych/nodes/scalar.rb', line 40 def quoted @quoted end |
#style ⇒ Object
The style of this scalar
43 44 45 |
# File 'lib/psych/nodes/scalar.rb', line 43 def style @style end |
#tag ⇒ Object
The tag value (if there is one)
34 35 36 |
# File 'lib/psych/nodes/scalar.rb', line 34 def tag @tag end |
#value ⇒ Object
The scalar value
28 29 30 |
# File 'lib/psych/nodes/scalar.rb', line 28 def value @value end |
Instance Method Details
#scalar? ⇒ Boolean
67 |
# File 'lib/psych/nodes/scalar.rb', line 67 def scalar?; true; end |