Sha256: fb8cb3e58769931fa2db57b5acd858b624ce73be1bb9cd6d1244cf34409dc437

Contents?: true

Size: 1.35 KB

Versions: 32

Compression:

Stored size: 1.35 KB

Contents

module Cuboid
module UI
module OutputInterface

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

    def self.initialize
        @@verbose = false
        @@debug   = 0
    end

    # Enables {#print_verbose} messages.
    #
    # @see #verbose?
    def verbose_on
        @@verbose = true
    end
    alias :verbose :verbose_on

    # Disables {#print_verbose} messages.
    #
    # @see #verbose?
    def verbose_off
        @@verbose = false
    end

    # @return    [Bool]
    def verbose?
        @@verbose
    end

    # Enables {#print_debug} messages.
    #
    # @param    [Integer]   level
    #   Sets the debugging level.
    #
    # @see #debug?
    def debug_on( level = 1 )
        @@debug = level
    end
    alias :debug :debug_on

    # Disables {#print_debug} messages.
    #
    # @see #debug?
    def debug_off
        @@debug = 0
    end

    # @return   [Integer]
    #   Debugging level.
    def debug_level
        @@debug
    end

    # @param    [Integer]   level
    #   Checks against this level.
    #
    # @return   [Bool]
    #
    # @see #debug
    def debug?( level = 1 )
        @@debug >= level
    end

    def debug_level_1?
        debug? 1
    end
    def debug_level_2?
        debug? 2
    end
    def debug_level_3?
        debug? 3
    end
    def debug_level_4?
        debug? 4
    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/controls.rb
cuboid-0.2.10 lib/cuboid/ui/output_interface/controls.rb
cuboid-0.2.9 lib/cuboid/ui/output_interface/controls.rb
cuboid-0.2.8 lib/cuboid/ui/output_interface/controls.rb
cuboid-0.2.7 lib/cuboid/ui/output_interface/controls.rb
cuboid-0.2.6 lib/cuboid/ui/output_interface/controls.rb
cuboid-0.2.5 lib/cuboid/ui/output_interface/controls.rb
cuboid-0.2.4.2 lib/cuboid/ui/output_interface/controls.rb
cuboid-0.2.4.1 lib/cuboid/ui/output_interface/controls.rb
cuboid-0.2.4 lib/cuboid/ui/output_interface/controls.rb
cuboid-0.2.3 lib/cuboid/ui/output_interface/controls.rb
cuboid-0.2.2 lib/cuboid/ui/output_interface/controls.rb
cuboid-0.2.1 lib/cuboid/ui/output_interface/controls.rb
cuboid-0.2 lib/cuboid/ui/output_interface/controls.rb
cuboid-0.1.9.1 lib/cuboid/ui/output_interface/controls.rb
cuboid-0.1.9 lib/cuboid/ui/output_interface/controls.rb
cuboid-0.1.8 lib/cuboid/ui/output_interface/controls.rb
cuboid-0.1.7 lib/cuboid/ui/output_interface/controls.rb
cuboid-0.1.6.1 lib/cuboid/ui/output_interface/controls.rb
cuboid-0.1.6 lib/cuboid/ui/output_interface/controls.rb