Skip to content

Commit 3174774

Browse files
committed
Exposing the TracePoint object seems overly dependent on the impl
1 parent 00a5d49 commit 3174774

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

lib/orthoses/trace/attribute.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def build_trace_hook
6464
mod_name = m[1]
6565
end
6666
next unless mod_name
67-
next unless target?(mod_name, tp1)
67+
next unless target?(mod_name)
6868
is_singleton = tp1.self.singleton_class?
6969
prefix = is_singleton ? "self." : ""
7070
kind = tp1.method_id

lib/orthoses/trace/attribute_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class TraceAttributeTest::Foo::Baz
121121
end
122122

123123
def test_pattern_proc(t)
124-
patterns = ->(name, tp) { tp.self.name == "TraceAttributeTest::Foo" }
124+
patterns = ->(name) { name == "TraceAttributeTest::Foo" }
125125
store = Orthoses::Trace::Attribute.new(->{
126126
LOADER_ATTRIBUTE.call
127127
foo = Foo.new

lib/orthoses/trace/method.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def build_trace_point
4444
kind = :instance
4545
end
4646

47-
next unless target?(mod_name, tp)
47+
next unless target?(mod_name)
4848

4949
case tp.event
5050
when :call

lib/orthoses/trace/method_test.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def self.a: () -> Integer
142142

143143
def test_pattern_proc(t)
144144
# only non-private methods
145-
patterns = ->(name, tp) { name == "TraceMethodTest::M" && !tp.self.private_methods.include?(tp.method_id) }
145+
patterns = ->(name) { name == "TraceMethodTest::M" }
146146
store = Orthoses::Trace::Method.new(-> {
147147
LOADER_METHOD.call
148148

@@ -156,7 +156,9 @@ def test_pattern_proc(t)
156156
actual = store.map { |n, c| c.to_rbs }.join("\n")
157157
expect = <<~RBS
158158
class TraceMethodTest::M
159+
private def initialize: (Integer a) -> void
159160
def a_ten: () -> Integer
161+
private def priv: (bool bool) -> Integer
160162
def call_priv: (bool c) -> Integer
161163
end
162164
RBS

lib/orthoses/trace/targetable.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
module Orthoses
44
class Trace
55
module Targetable
6-
def target?(name, tp)
6+
def target?(name)
77
if @patterns.respond_to?(:call)
8-
@patterns.call(name, tp)
8+
@patterns.call(name)
99
else
1010
@patterns.any? do |pattern|
1111
if pattern.end_with?("*")

0 commit comments

Comments
 (0)