module GemFootprintAnalyzer::CLI::Utils

A module containing helper methods for CLI

Public Class Methods

safe_puts(output) click to toggle source

Outputs strings to STDOUT, in case it's no longer possible (ex. when piped to head), it exits the process. @param output [String] message to be outputted to STDOUT

# File lib/gem_footprint_analyzer/cli/utils.rb, line 8
def self.safe_puts(output)
  output ||= "\n"

  string_output = output.is_a?(String) ? output : output.join("\n")

  puts string_output
rescue Errno::EPIPE
  exit
end