Class: Psych::Nodes::Scalar (Ruby 2.4.2)
Description: Class : Psych::Nodes::Scalar - Ruby 2.4.2

Support for the Ruby 2.4 series has ended. See here for reference.

### Home Classes Methods

### In Files

- psych/lib/psych/nodes/scalar.rb
- psych/lib/psych/visitors/yaml_tree.rb

### Parent

Psych::Nodes::Node

### Methods

- ::new

### Class/Module Index

Quicksearch

- Kernel
- Module
- Object
- Psych
- Psych::BadAlias
- Psych::ClassLoader
- Psych::ClassLoader::Restricted
- Psych::Coder
- Psych::DisallowedClass
- Psych::Emitter
- Psych::Exception
- Psych::Handler
- Psych::Handler::DumperOptions
- Psych::Handlers
- Psych::Handlers::Recorder
- Psych::JSON
- Psych::JSON::Stream
- Psych::JSON::TreeBuilder
- Psych::Nodes
- Psych::Nodes::Alias
- Psych::Nodes::Document
- Psych::Nodes::Mapping
- Psych::Nodes::Node
- Psych::Nodes::Scalar
- Psych::Nodes::Sequence
- Psych::Nodes::Stream
- Psych::Omap
- Psych::Parser
- Psych::Parser::Mark
- Psych::ScalarScanner
- Psych::Set
- Psych::Stream
- Psych::Streaming
- Psych::Streaming::ClassMethods
- Psych::SyntaxError
- Psych::TreeBuilder
- Psych::Visitors
- Psych::Visitors::DepthFirst
- Psych::Visitors::Emitter
- Psych::Visitors::JSONTree
- Psych::Visitors::NoAliasRuby
- Psych::Visitors::ToRuby
- Psych::Visitors::Visitor
- Psych::Visitors::YAMLTree
- Regexp

No matching classes.

# Psych::Nodes::Scalar

This class represents a YAML Scalar.

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

### Constants

ANY

  Any style scalar, the emitter chooses

DOUBLE_QUOTED

  Double quoted style

FOLDED

  Folded style

LITERAL

  Literal style

PLAIN

  Plain scalar style

SINGLE_QUOTED

  Single quoted style

### Attributes

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

### Public Class Methods

new(value, anchor = nil, tag = nil, plain = true, quoted = false, style = ANY) click to toggle source

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

                   # File 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