Class: PrivatePlease::Tracking::TracePointDetails
- Inherits:
-
Struct
- Object
- Struct
- PrivatePlease::Tracking::TracePointDetails
- Defined in:
- lib/private_please/tracking/trace_point_details.rb
Instance Attribute Summary collapse
-
#_self ⇒ Object
Returns the value of attribute _self.
-
#defined_class ⇒ Object
Returns the value of attribute defined_class.
-
#event ⇒ Object
Returns the value of attribute event.
-
#lineno ⇒ Object
Returns the value of attribute lineno.
-
#method_id ⇒ Object
Returns the value of attribute method_id.
-
#object_id ⇒ Object
Returns the value of attribute object_id.
-
#path ⇒ Object
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #code ⇒ Object
-
#method_full_name ⇒ Object
Combine the class and method name with the proper separator Examples: Array#new Array.size.
- #same_object?(other) ⇒ Boolean
Instance Attribute Details
#_self ⇒ Object
Returns the value of attribute _self
3 4 5 |
# File 'lib/private_please/tracking/trace_point_details.rb', line 3 def _self @_self end |
#defined_class ⇒ Object
Returns the value of attribute defined_class
3 4 5 |
# File 'lib/private_please/tracking/trace_point_details.rb', line 3 def defined_class @defined_class end |
#event ⇒ Object
Returns the value of attribute event
3 4 5 |
# File 'lib/private_please/tracking/trace_point_details.rb', line 3 def event @event end |
#lineno ⇒ Object
Returns the value of attribute lineno
3 4 5 |
# File 'lib/private_please/tracking/trace_point_details.rb', line 3 def lineno @lineno end |
#method_id ⇒ Object
Returns the value of attribute method_id
3 4 5 |
# File 'lib/private_please/tracking/trace_point_details.rb', line 3 def method_id @method_id end |
#object_id ⇒ Object
Returns the value of attribute object_id
3 4 5 |
# File 'lib/private_please/tracking/trace_point_details.rb', line 3 def object_id @object_id end |
#path ⇒ Object
Returns the value of attribute path
3 4 5 |
# File 'lib/private_please/tracking/trace_point_details.rb', line 3 def path @path end |
Class Method Details
.from(tp) ⇒ Object
4 5 6 |
# File 'lib/private_please/tracking/trace_point_details.rb', line 4 def self.from(tp) new(tp.event, tp.self.object_id, tp.path, tp.lineno, tp.defined_class, tp.method_id, tp.self) end |
Instance Method Details
#code ⇒ Object
12 13 14 |
# File 'lib/private_please/tracking/trace_point_details.rb', line 12 def code @_code ||= File.readlines(path)[lineno - 1].chomp end |
#method_full_name ⇒ Object
Combine the class and method name with the proper separator Examples:
Array#new
Array.size
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/private_please/tracking/trace_point_details.rb', line 20 def method_full_name defined_class_s = defined_class.to_s is_module_class_method = defined_class_s.start_with?('#<Class:') if is_module_class_method defined_class_s.gsub!(/^#<Class:/, '').delete!('>') "#{defined_class_s}.#{method_id}" elsif module_method? "#{defined_class}##{method_id}" else instance_method = !(_self.class == Class) instance_method ? "#{defined_class}##{method_id}" : "#{_self}.#{method_id}" end end |
#same_object?(other) ⇒ Boolean
8 9 10 |
# File 'lib/private_please/tracking/trace_point_details.rb', line 8 def same_object?(other) object_id == other.object_id end |