Class: Psychgus::Stylers::FlowStyler

Inherits:
Object
  • Object
show all
Includes:
Psychgus::Stylables::MapFlowStylable, Psychgus::Stylables::SeqFlowStylable
Defined in:
lib/psychgus/stylers.rb

Overview

A FLOW style changer for Mappings & Sequences.

Examples:

require 'psychgus'

data = {
  'Eggs' => {
    'Styles' => ['Fried', 'Scrambled', ['BBQ', 'Ketchup']],
    'Colors' => ['Brown', 'White', ['Blue', 'Green']]
}}

puts data.to_yaml(stylers: Psychgus::FlowStyler.new)

# Output:
# --- {Eggs: {Styles: [Fried, Scrambled, [BBQ, Ketchup]], Colors: [Brown, White, [Blue, Green]]}}

# >= level 4 (see Psychgus.hierarchy)
puts data.to_yaml(stylers: Psychgus::FlowStyler.new(4))

# Output:
# ---
# Eggs:
#   Styles: [Fried, Scrambled, [BBQ, Ketchup]]
#   Colors: [Brown, White, [Blue, Green]]

# >= level 6 (see Psychgus.hierarchy)
puts data.to_yaml(stylers: Psychgus::FlowStyler.new(6))

# Output:
# ---
# Eggs:
#   Styles:
#   - Fried
#   - Scrambled
#   - [BBQ, Ketchup]
#   Colors:
#   - Brown
#   - White
#   - [Blue, Green]

See Also:

Since:

  • 1.2.0

Constant Summary

Constants included from Psychgus::Styler

Psychgus::Styler::EMPTY

Instance Attribute Summary

Attributes included from Psychgus::Stylables::StyleStylable

#min_level, #new_style

Method Summary

Methods included from Psychgus::Stylables::SeqFlowStylable

#initialize, #style_sequence

Methods included from Psychgus::Stylables::StyleStylable

#change_style, #initialize

Methods included from Psychgus::Styler

#style, #style_alias, #style_document, #style_mapping, #style_scalar, #style_sequence, #style_stream

Methods included from Psychgus::Stylables::MapFlowStylable

#initialize, #style_mapping