class Yalphabetize::Writer
Constants
- MAX_LINE_WIDTH
Attributes
Public Class Methods
Source
# File lib/yalphabetize/writer.rb, line 7 def initialize(stream_node, path) @stream_node = stream_node @path = path end
Public Instance Methods
Source
# File lib/yalphabetize/writer.rb, line 12 def call indent_sequences File.write(path, new_file_content) end
Private Instance Methods
Source
# File lib/yalphabetize/writer.rb, line 30 def indent_sequences @_new_file_content = SequenceIndenter.call(new_file_content) end
Source
# File lib/yalphabetize/writer.rb, line 22 def new_file_content @_new_file_content ||= if Yalphabetize.config['preserve_comments'] Psych::Comments.emit_yaml stream_node else stream_node.to_yaml(nil, line_width: MAX_LINE_WIDTH) end end