Class: Yalphabetize::Writer

Inherits:
Object
  • Object
show all
Defined in:
lib/yalphabetize/writer.rb

Constant Summary collapse

MAX_LINE_WIDTH =
-1

Instance Method Summary collapse

Constructor Details

#initialize(stream_node, path, interpolations_mapping) ⇒ Writer

Returns a new instance of Writer.



7
8
9
10
11
# File 'lib/yalphabetize/writer.rb', line 7

def initialize(stream_node, path, interpolations_mapping)
  @stream_node = stream_node
  @path = path
  @interpolations_mapping = interpolations_mapping
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
# File 'lib/yalphabetize/writer.rb', line 13

def call
  indent_sequences
  replace_interpolations

  File.open(path, 'w') do |file|
    file.write new_file_content
  end
end