class PrivatePlease::Tracking::TracePointDetails

Public Class Methods

from(tp) click to toggle source
# 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

Public Instance Methods

code() click to toggle source
# File lib/private_please/tracking/trace_point_details.rb, line 12
def code
  @_code ||= File.readlines(path)[lineno - 1].chomp
end
method_full_name() click to toggle source

Combine the class and method name with the proper separator Examples:

Array#new
Array.size
# 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) click to toggle source
# File lib/private_please/tracking/trace_point_details.rb, line 8
def same_object?(other)
  object_id == other.object_id
end

Private Instance Methods

module_method?() click to toggle source
# File lib/private_please/tracking/trace_point_details.rb, line 38
def module_method?
  defined_class.instance_of?(Module)
end