Sha256: 6d644612a7c081b919672cfc4bc8662524291062e7726bccd829189849557ba1

Contents?: true

Size: 839 Bytes

Versions: 9

Compression:

Stored size: 839 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

9 entries across 9 versions & 1 rubygems

Version Path
xmvc-0.1.12 lib/xmvc/ui.rb
xmvc-0.1.11 lib/xmvc/ui.rb
xmvc-0.1.10 lib/xmvc/ui.rb
xmvc-0.1.9 lib/xmvc/ui.rb
xmvc-0.1.8 lib/xmvc/ui.rb
xmvc-0.1.7 lib/xmvc/ui.rb
xmvc-0.1.6 lib/xmvc/ui.rb
xmvc-0.1.5 lib/xmvc/ui.rb
xmvc-0.1.4 lib/xmvc/ui.rb