Skip to content

Commit ec73465

Browse files
committed
Fix comments for respond_to? method.
1 parent fcca293 commit ec73465

File tree

1 file changed

+5
-2
lines changed
  • packages/gems/js/lib

1 file changed

+5
-2
lines changed

packages/gems/js/lib/js.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,11 @@ def await
252252
::JS.promise_scheduler.await(promise)
253253
end
254254

255-
# I don't know why, but I can't define the respond_to? method in refinements.
256-
# I'm defining it here instead.
255+
# The `respond_to?` method is only used in unit tests.
256+
# There is little need to define it here.
257+
# However, methods suffixed with `?` do not conflict with JavaScript methods.
258+
# As there are no disadvantages, we will define the `respond_to?` method here
259+
# in the same way as the `nil?` and `is_a?` methods, prioritizing convenience.
257260
[:nil?, :is_a?, :raise, :respond_to?].each do |method|
258261
define_method(method, ::Object.instance_method(method))
259262
end

0 commit comments

Comments
 (0)