Module: BinData

Extended by:
BitFieldFactory, IntFactory
Defined in:
lib/bindata/io.rb,
lib/bindata/dsl.rb,
lib/bindata/int.rb,
lib/bindata/base.rb,
lib/bindata/bits.rb,
lib/bindata/lazy.rb,
lib/bindata/name.rb,
lib/bindata/rest.rb,
lib/bindata/skip.rb,
lib/bindata/array.rb,
lib/bindata/float.rb,
lib/bindata/trace.rb,
lib/bindata/choice.rb,
lib/bindata/offset.rb,
lib/bindata/params.rb,
lib/bindata/record.rb,
lib/bindata/string.rb,
lib/bindata/struct.rb,
lib/bindata/stringz.rb,
lib/bindata/version.rb,
lib/bindata/virtual.rb,
lib/bindata/registry.rb,
lib/bindata/sanitize.rb,
lib/bindata/alignment.rb,
lib/bindata/framework.rb,
lib/bindata/primitive.rb,
lib/bindata/deprecated.rb,
lib/bindata/base_primitive.rb,
lib/bindata/count_bytes_remaining.rb

Defined Under Namespace

Modules: AcceptedParametersPlugin, BitAligned, BitField, BitFieldFactory, CheckOrAdjustOffsetPlugin, CopyOnChangePlugin, DSLMixin, FloatingPoint, Framework, InitialLengthPlugin, Int, IntFactory, ReadUntilEOFPlugin, ReadUntilPlugin, RegisterNamePlugin Classes: Array, Base, BaseArgExtractor, BasePrimitive, Choice, CountBytesRemaining, DoubleBe, DoubleLe, FloatBe, FloatLe, IO, Int8, LazyEvaluator, Primitive, Record, RecordArgExtractor, Registry, Rest, ResumeByteAlignment, SanitizedBigEndian, SanitizedChoices, SanitizedField, SanitizedFields, SanitizedLittleEndian, SanitizedParameter, SanitizedParameters, SanitizedPrototype, Skip, String, Stringz, Struct, Tracer, Uint8, UnRegisteredTypeError, ValidityError, Virtual

Constant Summary collapse

VERSION =
"1.6.0"
RegisteredClasses =

A singleton registry of all registered classes.

Registry.new

Class Method Summary collapse

Methods included from IntFactory

const_missing

Methods included from BitFieldFactory

const_missing

Class Method Details

.trace_message {|@tracer| ... } ⇒ Object

:nodoc:

Yields:

  • (@tracer)


39
40
41
# File 'lib/bindata/trace.rb', line 39

def trace_message(&block) #:nodoc:
  yield @tracer if @tracer
end

.trace_reading(io = STDERR, &block) ⇒ Object

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.



26
27
28
29
30
31
32
33
34
35
36
37
# 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