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

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(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 indicating the string style

See Also

See also Handler#scalar

[ GitHub ]

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

The anchor value (if there is one)

[ GitHub ]

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

attr_accessor :anchor

#plain (rw)

Is this a plain scalar?

[ GitHub ]

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

attr_accessor :plain

#quoted (rw)

Is this scalar quoted?

[ GitHub ]

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

attr_accessor :quoted

#scalar?Boolean (readonly)

[ GitHub ]

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

def scalar?; true; end

#style (rw)

The style of this scalar

[ GitHub ]

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

attr_accessor :style

#tag (rw)

The tag value (if there is one)

[ GitHub ]

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

attr_accessor :tag

#value (rw)

The scalar value

[ GitHub ]

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

attr_accessor :value