Sha256: a247068b6de0f76e6d2293125386434567cbd29711da5e4f33bc46497235f8e2

Contents?: true

Size: 884 Bytes

Versions: 4

Compression:

Stored size: 884 Bytes

Contents

class Rag
  class UI
    def warn(message)
    end

    def debug(message)
    end

    def error(message)
    end

    def info(message)
    end

    def confirm(message)
    end

    # delegate to info
    def say(message)
      info(message)
    end

    class Shell < UI
      attr_accessor :shell

      def initialize(shell)
        @shell = shell
        @quiet = false
        @debug = ENV['DEBUG']
      end

      def be_quiet!
        @quiet = true
      end

      def debug!
        @debug = true
      end

      def debug(msg)
        @shell.say(msg) if @debug && !@quiet
      end

      def info(msg)
        @shell.say(msg) if !@quiet
      end

      def confirm(msg)
        @shell.say(msg, :green) if !@quiet
      end

      def warn(msg)
        @shell.say(msg, :yellow)
      end

      def error(msg)
        @shell.say(msg, :red)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rag-1.3.0 lib/rag/ui.rb
rag-1.2.1 lib/rag/ui.rb
rag-1.2.0 lib/rag/ui.rb
rag-1.1.0 lib/rag/ui.rb