Sha256: 777f4745f3bda632c4851ea613616bad7506a5cb465f86e2487603a3c32cb08a
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
module PrivatePlease module Tracking class TracePointDetails < Struct.new(:event, :object_id, :path, :lineno, :defined_class, :method_id, :_self) def self.from(tp) new(tp.event, tp.self.object_id, tp.path, tp.lineno, tp.defined_class, tp.method_id, tp.self) end def same_object?(other) object_id == other.object_id end def code @_code ||= File.readlines(path)[lineno - 1].chomp end # Combine the class and method name with the proper separator # Examples: # Array#new # Array.size def method_full_name if module_method? instance_method = defined_class.instance_methods.include?(method_id) instance_method ? "#{defined_class}##{method_id}" : "#{defined_class}.#{method_id}" else instance_method = !(_self.class == Class) instance_method ? "#{defined_class}##{method_id}" : "#{_self}.#{method_id}" end end private def module_method? defined_class.instance_of?(Module) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
private_please-0.1.1 | lib/private_please/tracking/trace_point_details.rb |
private_please-0.1.0 | lib/private_please/tracking/trace_point_details.rb |