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.18 lib/berkshelf/ui.rb
berkshelf-2.0.17 lib/berkshelf/ui.rb
berkshelf-2.0.16 lib/berkshelf/ui.rb
berkshelf-2.0.15 lib/berkshelf/ui.rb
berkshelf-2.0.14 lib/berkshelf/ui.rb
berkshelf-2.0.13 lib/berkshelf/ui.rb
berkshelf-2.0.12 lib/berkshelf/ui.rb
berkshelf-2.0.11 lib/berkshelf/ui.rb
berkshelf-3.0.0.beta4 lib/berkshelf/ui.rb
berkshelf-3.0.0.beta3 lib/berkshelf/ui.rb
berkshelf-2.0.10 lib/berkshelf/ui.rb
berkshelf-2.0.9 lib/berkshelf/ui.rb
berkshelf-2.0.8 lib/berkshelf/ui.rb
berkshelf-3.0.0.beta2 lib/berkshelf/ui.rb
berkshelf-3.0.0.beta1 lib/berkshelf/ui.rb
berkshelf-2.0.7 lib/berkshelf/ui.rb
berkshelf-2.0.6 lib/berkshelf/ui.rb
berkshelf-2.0.5 lib/berkshelf/ui.rb
berkshelf-2.0.4 lib/berkshelf/ui.rb
berkshelf-1.4.6 lib/berkshelf/ui.rb