Class: RubySnooper::TraceWriter::Line

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_snooper/trace_writer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method_id, event, number, time, code, local_variables, new_variables, modified_variables, file_path) ⇒ Line

Returns a new instance of Line.



66
67
68
69
70
71
72
73
74
75
76
# File 'lib/ruby_snooper/trace_writer.rb', line 66

def initialize(method_id, event, number, time, code, local_variables, new_variables, modified_variables, file_path)
  @method_id = method_id
  @event = event
  @number = number
  @time = time
  @code = code
  @local_variables = local_variables
  @new_variables = new_variables
  @modified_variables = modified_variables
  @file_path = file_path
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



64
65
66
# File 'lib/ruby_snooper/trace_writer.rb', line 64

def code
  @code
end

#eventObject (readonly)

Returns the value of attribute event.



64
65
66
# File 'lib/ruby_snooper/trace_writer.rb', line 64

def event
  @event
end

#local_variablesObject (readonly)

Returns the value of attribute local_variables.



64
65
66
# File 'lib/ruby_snooper/trace_writer.rb', line 64

def local_variables
  @local_variables
end

#method_idObject (readonly)

Returns the value of attribute method_id.



64
65
66
# File 'lib/ruby_snooper/trace_writer.rb', line 64

def method_id
  @method_id
end

#modified_variablesObject (readonly)

Returns the value of attribute modified_variables.



64
65
66
# File 'lib/ruby_snooper/trace_writer.rb', line 64

def modified_variables
  @modified_variables
end

#new_variablesObject (readonly)

Returns the value of attribute new_variables.



64
65
66
# File 'lib/ruby_snooper/trace_writer.rb', line 64

def new_variables
  @new_variables
end

#numberObject (readonly)

Returns the value of attribute number.



64
65
66
# File 'lib/ruby_snooper/trace_writer.rb', line 64

def number
  @number
end

#timeObject (readonly)

Returns the value of attribute time.



64
65
66
# File 'lib/ruby_snooper/trace_writer.rb', line 64

def time
  @time
end

Instance Method Details



78
79
80
81
82
# File 'lib/ruby_snooper/trace_writer.rb', line 78

def print
  STDERR.puts "From #{@file_path}" if @event == :call
  print_variables
  STDERR.puts "#{Time.now.strftime("%T,%L")} #{@event}   #{number.to_s.rjust(4)} #{code_colorized(code)}"
end