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/params.rb,
lib/bindata/record.rb,
lib/bindata/string.rb,
lib/bindata/struct.rb,
lib/bindata/section.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/transform/xz.rb,
lib/bindata/transform/lz4.rb,
lib/bindata/transform/xor.rb,
lib/bindata/base_primitive.rb,
lib/bindata/transform/lzma.rb,
lib/bindata/transform/zlib.rb,
lib/bindata/transform/zstd.rb,
lib/bindata/transform/brotli.rb,
lib/bindata/count_bytes_remaining.rb

Defined Under Namespace

Modules: AcceptedParametersPlugin, BitAligned, BitField, BitFieldFactory, CopyOnChangePlugin, DSLMixin, FloatingPoint, Framework, IO, Int, IntFactory, MultiFieldArgSeparator, RegisterNamePlugin, TraceHook, Transform 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, Section, SectionArgProcessor, Skip, SkipArgProcessor, String, StringArgProcessor, Stringz, Struct, StructArgProcessor, Tracer, Uint8, Uint8Array, Uint8ArrayArgProcessor, UnRegisteredTypeError, ValidityError, Virtual

Constant Summary collapse

VERSION =
'2.5.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)


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

def trace_message # :nodoc:
  yield @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.



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/bindata/trace.rb', line 6

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