Class: Psych::Pure::Emitter::Formatter
- Inherits:
-
PP
- Object
- PP
- Psych::Pure::Emitter::Formatter
- Defined in:
- lib/psych/pure.rb
Overview
This is a specialized pretty printer that knows how to format trailing comment.
Instance Method Summary collapse
- #breakable(sep = " ", width = sep.length) ⇒ Object
-
#trailer(&block) ⇒ Object
Register a block to be called when the next breakable is flushed.
-
#trailers ⇒ Object
These are blocks in the doc tree that should be flushed whenever we are about to flush a breakable.
Instance Method Details
#breakable(sep = " ", width = sep.length) ⇒ Object
4571 4572 4573 4574 4575 |
# File 'lib/psych/pure.rb', line 4571 def breakable(sep = " ", width = sep.length) (current_trailers = trailers).each(&:call) current_trailers.clear super(sep, width) end |
#trailer(&block) ⇒ Object
Register a block to be called when the next breakable is flushed.
4584 4585 4586 |
# File 'lib/psych/pure.rb', line 4584 def trailer(&block) trailers << block end |
#trailers ⇒ Object
These are blocks in the doc tree that should be flushed whenever we are about to flush a breakable.
4579 4580 4581 |
# File 'lib/psych/pure.rb', line 4579 def trailers @trailers ||= [] end |