123456789_123456789_123456789_123456789_123456789_

Class: Psych::Nodes::Mapping

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

Overview

This class represents a YAML Mapping.

A Mapping node may have 0 or more children, but must have an even number of children. Here are the valid children a Mapping node may have:

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(anchor = nil, tag = nil, implicit = true, style = BLOCK) ⇒ Mapping

Create a new Mapping object.

#anchor is the anchor associated with the map or nil. #tag is the tag associated with the map or nil. #implicit is a boolean indicating whether or not the map was implicitly started. #style is an integer indicating the mapping style.

See Also

See also Handler#start_mapping

[ GitHub ]

  
# File 'ext/psych/lib/psych/nodes/mapping.rb', line 48

def initialize anchor = nil, tag = nil, implicit = true, style = BLOCK
  super()
  @anchor   = anchor
  @tag      = tag
  @implicit = implicit
  @style    = style
end

Instance Attribute Details

#anchor (rw)

The optional anchor for this mapping

[ GitHub ]

  
# File 'ext/psych/lib/psych/nodes/mapping.rb', line 26

attr_accessor :anchor

#implicit (rw)

Is this an implicit mapping?

[ GitHub ]

  
# File 'ext/psych/lib/psych/nodes/mapping.rb', line 32

attr_accessor :implicit

#mapping?Boolean (readonly)

[ GitHub ]

  
# File 'ext/psych/lib/psych/nodes/mapping.rb', line 56

def mapping?; true; end

#style (rw)

The style of this mapping

[ GitHub ]

  
# File 'ext/psych/lib/psych/nodes/mapping.rb', line 35

attr_accessor :style

#tag (rw)

The optional tag for this mapping

[ GitHub ]

  
# File 'ext/psych/lib/psych/nodes/mapping.rb', line 29

attr_accessor :tag