Sha256: 5c518356249e75e72885b59f398baacd20a7e97a50c5842aa0fdeaf713f8b0da

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

require 'qcmd/version'
require 'qcmd/input_completer'

require 'qcmd/core_ext/array'
require 'qcmd/core_ext/osc/message'

module Qcmd
  # Your code goes here...
  autoload :Handler, 'qcmd/handler'
  autoload :Server, 'qcmd/server'
  autoload :Context, 'qcmd/context'
  autoload :Parser, 'qcmd/parser'
  autoload :CLI, 'qcmd/cli'
  autoload :Machine, 'qcmd/machine'
  autoload :Network, 'qcmd/network'
  autoload :QLab, 'qcmd/qlab'
  autoload :Plaintext, 'qcmd/plaintext'
  autoload :Commands, 'qcmd/commands'
  autoload :VERSION, 'qcmd/version'

  class << self
    include Qcmd::Plaintext

    attr_accessor :log_level
    attr_accessor :debug_mode
    attr_accessor :context

    def verbose!
      self.log_level = :debug
    end

    def quiet!
      self.log_level = :warning
    end

    def quiet?
      self.log_level == :warning
    end

    def while_quiet
      previous_level = self.log_level
      self.log_level = :warning unless previous_level == :debug
      yield
      self.log_level = previous_level
    end

    def debug?
      !!debug_mode
    end

    def debug message
      log(message) if log_level == :debug
    end

    def connected?
      !!context && !!context.machine && !context.machine.nil?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qcmd-0.1.6 lib/qcmd.rb
qcmd-0.1.5 lib/qcmd.rb