class StyledYAML::TreeBuilder
Custom tree builder class to recognize scalars tagged with `yaml_style`
Attributes
next_seq_or_map_style[W]
Public Instance Methods
next_seq_or_map_style(default_style)
click to toggle source
# File lib/styled_yaml.rb, line 68 def next_seq_or_map_style(default_style) style = @next_seq_or_map_style || default_style @next_seq_or_map_style = nil style end
scalar(value, anchor, tag, plain, quoted, style)
click to toggle source
Calls superclass method
# File lib/styled_yaml.rb, line 74 def scalar(value, anchor, tag, plain, quoted, style) if value.respond_to?(:yaml_style) if style_literal_or_folded? value.yaml_style plain = false quoted = true end style = value.yaml_style end super end
style_literal_or_folded?(style)
click to toggle source
# File lib/styled_yaml.rb, line 85 def style_literal_or_folded?(style) [Psych::Nodes::Scalar::LITERAL, Psych::Nodes::Scalar::FOLDED].include?(style) end