Skip to content

Commit 117904a

Browse files
committed
Less verbose Node#inspect.
1 parent 63b657b commit 117904a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/async/node.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ def description
219219

220220
if @annotation
221221
"#{@object_name} #{@annotation}"
222+
elsif line = self.backtrace(0, 1)&.first
223+
"#{@object_name} #{line}"
222224
else
223225
@object_name
224226
end
@@ -232,6 +234,8 @@ def to_s
232234
"\#<#{self.description}>"
233235
end
234236

237+
alias inspect to_s
238+
235239
# Change the parent of this node.
236240
# @param parent [Node, nil] the parent to attach to, or nil to detach.
237241
# @return [self]

0 commit comments

Comments
 (0)