Sha256: a656ad59ee559460c18561cdd1d9c1a4b3bfdd49af1bab49b5353cea06801691

Contents?: true

Size: 839 Bytes

Versions: 6

Compression:

Stored size: 839 Bytes

Contents

class Thor
  module Shell
    class Basic
      #
      # Prints an error message to `stderr`.
      #
      # @param [String] message
      #   The message to print to `stderr`.
      #
      # @param [Symbol, nil] color
      #   Optional ANSI color.
      #
      # @param [Boolean] force_new_line
      #   Controls whether a newline character will be appended to the output.
      #
      def say_error(message,color=nil,force_new_line=(message.to_s !~ /( |\t)\Z/))
        return if quiet?

        buffer = prepare_message(message,*color)
        buffer << $/ if force_new_line && !message.to_s.end_with?($/)

        stderr.print(buffer)
        stderr.flush
      end
    end

    module_eval <<-METHOD, __FILE__, __LINE__ + 1
      def say_error(*args,&block)
        shell.say_error(*args,&block)
      end
    METHOD
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bundler-audit-0.9.2 lib/bundler/audit/cli/thor_ext/shell/basic/say_error.rb
bundler-audit-0.9.1 lib/bundler/audit/cli/thor_ext/shell/basic/say_error.rb
bundler-audit-0.9.0.1 lib/bundler/audit/cli/thor_ext/shell/basic/say_error.rb
bundler-audit-0.9.0 lib/bundler/audit/cli/thor_ext/shell/basic/say_error.rb
bundler-audit-0.8.0 lib/bundler/audit/cli/thor_ext/shell/basic/say_error.rb
bundler-audit-0.8.0.rc2 lib/bundler/audit/cli/thor_ext/shell/basic/say_error.rb