module ENV_BANG::Formatter

Public Class Methods

formatted_error(var, description) click to toggle source
# File lib/env_bang/formatter.rb, line 4
      def formatted_error(var, description)
        indent(4, "

Missing required environment variable: #{var}#{description and "\n" <<
unindent(description) }
        ")
      end
indent(width, string) click to toggle source
# File lib/env_bang/formatter.rb, line 17
def indent(width, string)
  string.gsub("\n", "\n#{' ' * width}")
end
unindent(string) click to toggle source
# File lib/env_bang/formatter.rb, line 12
def unindent(string)
  width = string.scan(/^ */).map(&:length).min
  string.gsub(/^ {#{width}}/, '')
end