Sha256: 9dbbe8b77a8208c603578707d6c66dd28dda192f3bd3aeedf16cd4b73f7d1359

Contents?: true

Size: 1.04 KB

Versions: 23

Compression:

Stored size: 1.04 KB

Contents

module Berkshelf
  module UI
    # Mute the output of this instance of UI until {#unmute!} is called
    def mute!
      @mute = true
    end

    # Unmute the output of this instance of UI until {#mute!} is called
    def unmute!
      @mute = false
    end

    def say(message = '', color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
      return if quiet?

      super(message, color, force_new_line)
    end

    # @see {say}
    def info(message = '', color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
      say(message, color, force_new_line)
    end

    def say_status(status, message, log_status = true)
      return if quiet?

      super(status, message, log_status)
    end

    def warn(message, color = :yellow)
      return if quiet?

      say(message, color)
    end

    def deprecated(message)
      warn("[DEPRECATION] #{message}")
    end

    def error(message, color = :red)
      return if quiet?

      message = set_color(message, *color) if color
      super(message)
    end
    alias_method :fatal, :error
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
berkshelf-2.0.3 lib/berkshelf/ui.rb
berkshelf-2.0.1 lib/berkshelf/ui.rb
berkshelf-2.0.0 lib/berkshelf/ui.rb