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, #end_column, #end_line, #start_column, #start_line

Instance Method Summary collapse

Methods inherited from Node

#alias?, #document?, #each, #scalar?, #sequence?, #stream?, #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



48
49
50
51
52
53
54
# File '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

#anchorObject

The optional anchor for this mapping



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

def anchor
  @anchor
end

#implicitObject

Is this an implicit mapping?



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

def implicit
  @implicit
end

#styleObject

The style of this mapping



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

def style
  @style
end

#tagObject

The optional tag for this mapping



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

def tag
  @tag
end

Instance Method Details

#mapping?Boolean

Returns:

  • (Boolean)


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

def mapping?; true; end