123456789_123456789_123456789_123456789_123456789_

Class: Psych::Nodes::Scalar

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/scalar.rb

Overview

This class represents a YAML Scalar.

This node type is a terminal node and should not have any children.

Constant Summary

Class Method Summary

Node - Inherited

.new

Create a new Node

Instance Attribute Summary

  • #anchor rw

    The anchor value (if there is one).

  • #plain rw

    Is this a plain scalar?

  • #quoted rw

    Is this scalar quoted?

  • #style rw

    The style of this scalar.

  • #tag rw

    The tag value (if there is one).

  • #value rw

    The scalar value.

Node - Inherited

#children

The children of this node.

#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(value, anchor = nil, tag = nil, plain = true, quoted = false, style = ANY) ⇒ Scalar

Create a new 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 Handler#scalar

[ GitHub ]

  
# File 'ext/psych/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 (rw)

The anchor value (if there is one)

[ GitHub ]

  
# File 'ext/psych/lib/psych/nodes/scalar.rb', line 30

attr_accessor :anchor

#plain (rw)

Is this a plain scalar?

[ GitHub ]

  
# File 'ext/psych/lib/psych/nodes/scalar.rb', line 36

attr_accessor :plain

#quoted (rw)

Is this scalar quoted?

[ GitHub ]

  
# File 'ext/psych/lib/psych/nodes/scalar.rb', line 39

attr_accessor :quoted

#style (rw)

The style of this scalar

[ GitHub ]

  
# File 'ext/psych/lib/psych/nodes/scalar.rb', line 42

attr_accessor :style

#tag (rw)

The tag value (if there is one)

[ GitHub ]

  
# File 'ext/psych/lib/psych/nodes/scalar.rb', line 33

attr_accessor :tag

#value (rw)

The scalar value

[ GitHub ]

  
# File 'ext/psych/lib/psych/nodes/scalar.rb', line 27

attr_accessor :value