Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

obj.respond_to? :method_name isn't working correctly

オープン
#1,273 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
40/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
ruby
領域
api, backend

調査の方向性

まず、issue にある product API object と respond_to? の手順を使い、shopify_api version 13.4 で動作を再現します。respond_to? が true、false、または T::Private::Types::Void::VOID を返す仕組みを追跡します。完了とは、一貫して true または false を返し、サポートされていない呼び出しで NoMethodError が発生することです。

索引モデルが issue の本文から書いたものです。

説明

Issue summary

When using api_object.respond_to?(:method_name) the lib sometimes returns true and sometimes returns T::Private::Types::Void::VOID Sorbet private void type. It seems that true was returned if the method name had been previously used to dereference the object but on more inspection I am not so sure that's the case.

  • shopify_api version: 13.4
  • Ruby version:
  • Operating system:

Expected behavior

When calling respond_to? with a method name the object should return true if the object is able to respond to the method call or false if it is not, and if you call the method name on the object after it returns false it should raise a NoMethodError

Actual behavior

Sometimes the response is true, sometimes it's a private Sorbet type T::Private::Types::Void::VOID, and sometimes it switches from the private type to true after you dereference the object with the method in question.

Steps to reproduce the problem

  1. Instantiate an api object (I used a product)
  2. Invoke respond_to? on it ( api_object.respond_to? :some_bs_method )
  3. Bonus points - try invoking the method on the object after receiving the Sorbet type as a response and then calling respond_to? with the method name, it was returning true for me after doing so
主要言語
Ruby
スター
1.1k
フォーク
484
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Shopify/shopify-api-ruby のほかの issue

Shopify/shopify-api-ruby の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。