module BinData

Constants

RegisteredClasses

A singleton registry of all registered classes.

VERSION

Public Class Methods

trace_reading(io = STDERR, &block) click to toggle source

Turn on trace information when reading a BinData object. If block is given then the tracing only occurs for that block. This is useful for debugging a BinData declaration.

# File lib/bindata/trace.rb, line 26
def trace_reading(io = STDERR, &block)
  @tracer = Tracer.new(io)
  [BasePrimitive, Choice].each { |traced| traced.turn_on_tracing }
  if block_given?
    begin
      block.call
    ensure
      [BasePrimitive, Choice].each { |traced| traced.turn_off_tracing }
      @tracer = nil
    end
  end
end

Private Instance Methods

trace_reading(io = STDERR, &block) click to toggle source

Turn on trace information when reading a BinData object. If block is given then the tracing only occurs for that block. This is useful for debugging a BinData declaration.

# File lib/bindata/trace.rb, line 26
def trace_reading(io = STDERR, &block)
  @tracer = Tracer.new(io)
  [BasePrimitive, Choice].each { |traced| traced.turn_on_tracing }
  if block_given?
    begin
      block.call
    ensure
      [BasePrimitive, Choice].each { |traced| traced.turn_off_tracing }
      @tracer = nil
    end
  end
end