Class: Psych::Nodes::Mapping

Inherits:
Node show all
Defined in:
lib/psych/nodes/mapping.rb

Overview

This class represents a YAML Mapping.

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

  • Psych::Nodes::Sequence

  • Psych::Nodes::Mapping

  • Psych::Nodes::Scalar

  • Psych::Nodes::Alias

Constant Summary collapse

ANY =

Any Map Style

0
BLOCK =

Block Map Style

1
FLOW =

Flow Map Style

2

Instance Attribute Summary collapse

Attributes inherited from Node

#children

Instance Method Summary collapse

Methods inherited from Node

#each, #to_ruby, #yaml

Constructor Details

#initialize(anchor = nil, tag = nil, implicit = true, style = BLOCK) ⇒ Mapping

Create a new Psych::Nodes::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 Psych::Handler#start_mapping



47
48
49
50
51
52
53
# File 'lib/psych/nodes/mapping.rb', line 47

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

Instance Attribute Details

#anchorObject

The optional anchor for this mapping



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

def anchor
  @anchor
end

#implicitObject

Is this an implicit mapping?



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

def implicit
  @implicit
end

#styleObject

The style of this mapping



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

def style
  @style
end

#tagObject

The optional tag for this mapping



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

def tag
  @tag
end