Sha256: 2213414f1de607319f5444aa436da4338f903bb645c354115034b38c482f2dfb

Contents?: true

Size: 529 Bytes

Versions: 3

Compression:

Stored size: 529 Bytes

Contents

# Trace utility
#  
# Consists in a Trace class, and a Trace global method

# Trace "static" class, to be able to globally inhibit or activate traces 
#  Trace.inihibit
#  Trace.activate
class Trace
  @@active = true
  def Trace.active?
    return @@active
  end
  def Trace.inhibit
    @@active = nil
  end
  def Trace.activate
    @@active = true
  end
end

# Standard trace method
#   Trace("hello world") 
# Check before printing the string if traces are active
def Trace(string)
  if Trace.active?
    puts string
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xrvg-0.0.3 lib/trace.rb
xrvg-0.0.2 lib/trace.rb
xrvg-0.0.1 lib/trace.rb