Class: BinData::Tracer

Inherits:
Object
  • Object
show all
Defined in:
lib/bindata/trace.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ Tracer

Returns a new instance of Tracer.



6
7
8
# File 'lib/bindata/trace.rb', line 6

def initialize(io)
  @trace_io = io
end

Instance Method Details

#trace(msg) ⇒ Object



10
11
12
# File 'lib/bindata/trace.rb', line 10

def trace(msg)
  @trace_io.puts(msg)
end

#trace_obj(obj_name, val) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/bindata/trace.rb', line 14

def trace_obj(obj_name, val)
  if val.length > 30
    val = val.slice(0..30) + "..."
  end

  trace "#{obj_name} => #{val}"
end