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/buffer.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/warnings.rb,
lib/bindata/alignment.rb,
lib/bindata/framework.rb,
lib/bindata/primitive.rb,
lib/bindata/delayed_io.rb,
lib/bindata/uint8_array.rb,
lib/bindata/base_primitive.rb,
lib/bindata/count_bytes_remaining.rb

Defined Under Namespace

Modules: AcceptedParametersPlugin, BitAligned, BitField, BitFieldFactory, ByteAlignPlugin, CheckOrAdjustOffsetPlugin, CopyOnChangePlugin, DSLMixin, FloatingPoint, Framework, IO, InitialLengthPlugin, Int, IntFactory, MultiFieldArgSeparator, ReadUntilEOFPlugin, ReadUntilPlugin, RegisterNamePlugin, SkipLengthPlugin, SkipToAbsOffsetPlugin, SkipUntilValidPlugin, WarnNoReadLengthPlugin Classes: Array, ArrayArgProcessor, Base, BaseArgProcessor, BasePrimitive, Buffer, BufferArgProcessor, Choice, ChoiceArgProcessor, CountBytesRemaining, DelayedIO, DelayedIoArgProcessor, DoubleBe, DoubleLe, FloatBe, FloatLe, Int8, LazyEvaluator, Primitive, PrimitiveArgProcessor, Record, RecordArgProcessor, Registry, Rest, ResumeByteAlignment, SanitizedBigEndian, SanitizedChoices, SanitizedField, SanitizedFields, SanitizedLittleEndian, SanitizedParameter, SanitizedParameters, SanitizedPrototype, Skip, SkipArgProcessor, String, StringArgProcessor, Stringz, Struct, StructArgProcessor, Tracer, Uint8, Uint8Array, Uint8ArrayArgProcessor, UnRegisteredTypeError, ValidityError, Virtual

Constant Summary collapse

VERSION =
"2.4.12"
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)


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

def trace_message #:nodoc:
  yield @tracer if @tracer
end

.trace_reading(io = STDERR) ⇒ 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
38
# File 'lib/bindata/trace.rb', line 26

def trace_reading(io = STDERR)
  @tracer = Tracer.new(io)
  [BasePrimitive, Choice].each(&:turn_on_tracing)

  if block_given?
    begin
      yield
    ensure
      [BasePrimitive, Choice].each(&:turn_off_tracing)
      @tracer = nil
    end
  end
end