Class: RubySnooper::TraceWriter::Return
- Inherits:
-
Object
- Object
- RubySnooper::TraceWriter::Return
- Defined in:
- lib/ruby_snooper/trace_writer.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#method_id ⇒ Object
readonly
Returns the value of attribute method_id.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#return_value ⇒ Object
readonly
Returns the value of attribute return_value.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
- #code_colorized(str) ⇒ Object
- #colorized(str) ⇒ Object
-
#initialize(method_id, event, number, time, code, return_value, file_path) ⇒ Return
constructor
A new instance of Return.
- #print ⇒ Object
Constructor Details
#initialize(method_id, event, number, time, code, return_value, file_path) ⇒ Return
Returns a new instance of Return.
114 115 116 117 118 119 120 121 122 |
# File 'lib/ruby_snooper/trace_writer.rb', line 114 def initialize(method_id, event, number, time, code, return_value, file_path) @method_id = method_id @event = event @number = number @time = time @code = code @return_value = return_value @file_path = file_path end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
112 113 114 |
# File 'lib/ruby_snooper/trace_writer.rb', line 112 def code @code end |
#event ⇒ Object (readonly)
Returns the value of attribute event.
112 113 114 |
# File 'lib/ruby_snooper/trace_writer.rb', line 112 def event @event end |
#method_id ⇒ Object (readonly)
Returns the value of attribute method_id.
112 113 114 |
# File 'lib/ruby_snooper/trace_writer.rb', line 112 def method_id @method_id end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
112 113 114 |
# File 'lib/ruby_snooper/trace_writer.rb', line 112 def number @number end |
#return_value ⇒ Object (readonly)
Returns the value of attribute return_value.
112 113 114 |
# File 'lib/ruby_snooper/trace_writer.rb', line 112 def return_value @return_value end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
112 113 114 |
# File 'lib/ruby_snooper/trace_writer.rb', line 112 def time @time end |
Instance Method Details
#code_colorized(str) ⇒ Object
129 130 131 |
# File 'lib/ruby_snooper/trace_writer.rb', line 129 def code_colorized(str) ::CodeRay.scan(str, :ruby).term end |
#colorized(str) ⇒ Object
133 134 135 |
# File 'lib/ruby_snooper/trace_writer.rb', line 133 def colorized(str) "\e[0;31m#{str}\e[0m" end |
#print ⇒ Object
124 125 126 127 |
# File 'lib/ruby_snooper/trace_writer.rb', line 124 def print STDERR.puts "#{Time.now.strftime("%T,%L")} #{@event} #{@number.to_s.rjust(4)} #{code_colorized(@code)}" STDERR.puts colorized("Return value #{@return_value}") end |