module DebugMixin

This is used to turn on DEBUG notices.

Constants

DEBUG
DOCKER

Public Class Methods

debug(*a) click to toggle source
# File lib/conjur/debify.rb, line 38
def self.debug *a
  $stderr.puts *a if DEBUG
end
debug_write(*a) click to toggle source
# File lib/conjur/debify.rb, line 46
def self.debug_write *a
  $stderr.write *a if DEBUG
end
docker_debug(*a) click to toggle source

you can give this to various docker methods to print output if debug is on

# File lib/conjur/debify.rb, line 51
def self.docker_debug *a
  if a.length == 2 && a[0].is_a?(Symbol)
    debug a.last
  else
    a.each do |line|
      begin
        line = JSON.parse(line)
        line.keys.each do |k|
          debug line[k]
        end
      rescue JSON::ParserError
        # Docker For Mac is spitting out invalid JSON, so just print
        # out the line if parsing fails.
        debug line
      end
    end
  end
end

Public Instance Methods

debug(*a) click to toggle source
# File lib/conjur/debify.rb, line 34
def debug *a
  DebugMixin.debug *a
end
debug_write(*a) click to toggle source
# File lib/conjur/debify.rb, line 42
def debug_write *a
  DebugMixin.debug_write *a
end