Sha256: 3bd7baa443a306f3fd844ea74f58c400d3e169eece3e3e9f77b355ba02484032

Contents?: true

Size: 836 Bytes

Versions: 3

Compression:

Stored size: 836 Bytes

Contents

module Xmvc
  class UI
    def warn(message)
    end

    def error(message)
    end

    def info(message)
    end

    def confirm(message)
    end

    class Shell < UI
      def initialize(shell)
        @shell = shell
      end
        
      # TODO: Add debug mode
      def debug(msg)
      end

      def info(msg)
        @shell.say(msg)
      end

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

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

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

    class RGProxy < Gem::SilentUI
      def initialize(ui)
        @ui = ui
      end

      def say(message)
        if message =~ /native extensions/
          @ui.info "with native extensions "
        else
          @ui.debug(message)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xmvc-0.1.2 lib/xmvc/ui.rb
xmvc-0.1.1 lib/xmvc/ui.rb
xmvc-0.1.0 lib/xmvc/ui.rb