Method: Doing::WWID#write

Defined in:
lib/doing/wwid/filetools.rb

#write(file = nil, backup: true) ⇒ Object

Write content to file or STDOUT

Parameters:

  • file (String) (defaults to: nil)

    The filepath to write to



91
92
93
94
95
96
97
98
99
100
# File 'lib/doing/wwid/filetools.rb', line 91

def write(file = nil, backup: true)
  Hooks.trigger :pre_write, self, file
  output = combined_content
  if file.nil?
    $stdout.puts output
  else
    Util.write_to_file(file, output, backup: backup)
    run_after if Doing.setting('run_after')
  end
end