module Utils::IRB::Shell

def irb_write(filename, text = nil, &block)

Other tags:
    Yield: - a block that generates content to be written to the file

Parameters:
  • text (String, nil) -- the text content to write to the file, or
  • filename (String) -- the path to the file where content will be
def irb_write(filename, text = nil, &block)
  if text.nil? && block
    File.secure_write filename, nil, 'wb', &block
  else
    File.secure_write filename, text, 'wb'
  end
end