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.



24
25
26
# File 'lib/bindata/trace.rb', line 24

def initialize(io)
  @trace_io = io
end

Instance Method Details

#trace(msg) ⇒ Object



28
29
30
# File 'lib/bindata/trace.rb', line 28

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

#trace_obj(obj_name, val) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/bindata/trace.rb', line 32

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

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