We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
respond_to?
1 parent fcca293 commit ec73465Copy full SHA for ec73465
packages/gems/js/lib/js.rb
@@ -252,8 +252,11 @@ def await
252
::JS.promise_scheduler.await(promise)
253
end
254
255
- # I don't know why, but I can't define the respond_to? method in refinements.
256
- # I'm defining it here instead.
+ # The `respond_to?` method is only used in unit tests.
+ # 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.
260
[:nil?, :is_a?, :raise, :respond_to?].each do |method|
261
define_method(method, ::Object.instance_method(method))
262
0 commit comments