Class: Yaml::Merge::Emitter
- Inherits:
-
Ast::Merge::EmitterBase
- Object
- Ast::Merge::EmitterBase
- Yaml::Merge::Emitter
- Includes:
- Ast::Merge::EmitterLineMetadataSupport
- Defined in:
- lib/yaml/merge/emitter.rb
Instance Method Summary collapse
- #clear_subclass_state ⇒ Object
- #emit_blank_line ⇒ Object
- #emit_comment(text, inline: false) ⇒ Object
- #emit_raw_lines(raw_lines, metadata: nil) ⇒ Object
- #emit_tracked_comment(comment) ⇒ Object
- #initialize_subclass_state(**_options) ⇒ Object
- #to_yaml ⇒ Object
Instance Method Details
#clear_subclass_state ⇒ Object
12 13 14 |
# File 'lib/yaml/merge/emitter.rb', line 12 def clear_subclass_state end |
#emit_blank_line ⇒ Object
16 17 18 |
# File 'lib/yaml/merge/emitter.rb', line 16 def emit_blank_line append_line('') end |
#emit_comment(text, inline: false) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/yaml/merge/emitter.rb', line 25 def emit_comment(text, inline: false) if inline return if @lines.empty? @lines[-1] = "#{@lines[-1]} # #{text}" else append_line("#{current_indent}# #{text}") end end |
#emit_raw_lines(raw_lines, metadata: nil) ⇒ Object
35 36 37 38 39 |
# File 'lib/yaml/merge/emitter.rb', line 35 def emit_raw_lines(raw_lines, metadata: nil) raw_lines.each_with_index do |line, index| append_line(line.chomp, (, index)) end end |
#emit_tracked_comment(comment) ⇒ Object
20 21 22 23 |
# File 'lib/yaml/merge/emitter.rb', line 20 def emit_tracked_comment(comment) indent = ' ' * (comment[:indent] || 0) append_line("#{indent}# #{comment[:text]}") end |
#initialize_subclass_state(**_options) ⇒ Object
8 9 10 |
# File 'lib/yaml/merge/emitter.rb', line 8 def initialize_subclass_state(**) end |
#to_yaml ⇒ Object
41 42 43 |
# File 'lib/yaml/merge/emitter.rb', line 41 def to_yaml to_s end |