1
私はHTTPartyを使用して、クラスを作成することができますドキュメントに基づいています:モジュールを組み込むときにself.class.methodはどのように機能しますか?
class SomeClass
include HTTParty
base_uri 'host'
def index
self.class.get('/path')
end
end
私はモジュール内で宣言get
方法があるかわかりません。
モジュールはクラスシングルトンメソッドを提供します。これはあなたが 'self.class.get'を得る方法です –
** tl; dr ** - [' included'フック](https://github.com/jnunemaker/httparty /blob/master/lib/httparty.rb#L19-L26)。 – ndn