Sha256: 74e758bae39760fa6ce2adb1a8f2e64f833415f41192bd26d9de03444e92eab4

Contents?: true

Size: 752 Bytes

Versions: 8

Compression:

Stored size: 752 Bytes

Contents

module Sprinkle
  module Errors #:nodoc:
    
    class PrettyFailure < StandardError #:nodoc:
      
      attr_accessor :details
      
      def initialize(installer, details={}, previous_error=nil)
        @installer = installer
        @details = details
        @previous_error = previous_error
      end
            
      def log(s, o)
        puts s
        puts "-" * (s.length+2)
        puts o
        puts
      end
      
      def boxed(s)
        puts red("-"*54)
        puts red("| #{s.center(50)} |")
        puts red("-"*54)
        puts
      end
      
      private
      
      def color(code, s)
        "\033[%sm%s\033[0m"%[code,s]
      end
      
      def red(s)
        color(31, s)
      end
      
    end
    
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sprinkle-0.7.7 lib/sprinkle/errors/pretty_failure.rb
sprinkle-0.7.6.2 lib/sprinkle/errors/pretty_failure.rb
sprinkle-0.7.6.1 lib/sprinkle/errors/pretty_failure.rb
sprinkle-0.7.6 lib/sprinkle/errors/pretty_failure.rb
sprinkle-0.7.5 lib/sprinkle/errors/pretty_failure.rb
sprinkle-0.7.4 lib/sprinkle/errors/pretty_failure.rb
sprinkle-0.7.3 lib/sprinkle/errors/pretty_failure.rb
sprinkle-0.7.2 lib/sprinkle/errors/pretty_failure.rb