Class: YAMLRepro::TreeBuilder
- Defined in:
- lib/xmigra.rb
Constant Summary collapse
- Scalar =
::Psych::Nodes::Scalar
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ TreeBuilder
constructor
A new instance of TreeBuilder.
- #scalar(value, anchor, tag, plain, quoted, style) ⇒ Object
- #style_any?(style) ⇒ Boolean
- #style_block_scalar?(style) ⇒ Boolean
Constructor Details
#initialize(*args) ⇒ TreeBuilder
Returns a new instance of TreeBuilder.
95 96 97 98 |
# File 'lib/xmigra.rb', line 95 def initialize(*args) super @next_collection_style = nil end |
Instance Attribute Details
#next_collection_style(default_style) ⇒ Object
100 101 102 103 104 |
# File 'lib/xmigra.rb', line 100 def next_collection_style(default_style) style = @next_collection_style || default_style @next_collection_style = nil style end |
Instance Method Details
#scalar(value, anchor, tag, plain, quoted, style) ⇒ Object
106 107 108 109 110 111 112 113 114 |
# File 'lib/xmigra.rb', line 106 def scalar(value, anchor, tag, plain, quoted, style) if style_any?(style) and value.respond_to?(:yaml_style) and style = value.yaml_style if style_block_scalar?(style) plain = false quoted = true end end super end |
#style_any?(style) ⇒ Boolean
116 117 118 |
# File 'lib/xmigra.rb', line 116 def style_any?(style) Scalar::ANY == style end |