Sha256: 0c30f056ca2ea56db9c435a0f7a19088cec7ba524bfaac18b1811acd62394419

Contents?: true

Size: 1.2 KB

Versions: 32

Compression:

Stored size: 1.2 KB

Contents

module Cuboid
module UI
module OutputInterface

# @author Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
module Implemented

    # Prints the backtrace of an exception as error messages.
    #
    # @param    [Exception] e
    def print_error_backtrace( e )
        e.backtrace.each { |line| print_error( line ) }
    end

    def print_exception( e )
        print_error "[#{e.class}] #{e}"
        print_error_backtrace( e )
    end

    def print_debug_level_1( str = '' )
        print_debug( str, 1 )
    end

    def print_debug_level_2( str = '' )
        print_debug( str, 2 )
    end

    def print_debug_level_3( str = '' )
        print_debug( str, 3 )
    end

    def print_debug_level_4( str = '' )
        print_debug( str, 4 )
    end

    def print_debug_exception( e, level = 1 )
        return if !debug?

        print_debug( "[#{e.class}] #{e}", level )
        print_debug_backtrace( e, level )
    end

    # Prints the backtrace of an exception as debugging messages.
    #
    # @param    [Exception] e
    #
    # @see #debug?
    # @see #debug
    def print_debug_backtrace( e, level = 1 )
        return if !debug?
        e.backtrace.each { |line| print_debug( line, level ) }
    end

end

end
end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
cuboid-0.2.11 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.2.10 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.2.9 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.2.8 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.2.7 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.2.6 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.2.5 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.2.4.2 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.2.4.1 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.2.4 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.2.3 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.2.2 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.2.1 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.2 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.1.9.1 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.1.9 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.1.8 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.1.7 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.1.6.1 lib/cuboid/ui/output_interface/implemented.rb
cuboid-0.1.6 lib/cuboid/ui/output_interface/implemented.rb