在RBS文件上使用Gemfile中的类
我正在.rbs
Ruby中的文件中工作,我和我的应用程序都在工作,直到我决定声明redis
在中键入
.rbs
文件。
我使用的是gemfile redis
,然后我有此功能:
def redis_connect
Redis.new(host: REDIS_HOST, port: REDIS_PORT, password: REDIS_PASSWORD)
end
在.rbs
文件中,文件看起来像下一个:
def redis_connect: () -> Redis
但是我得到了错误找不到REDIS
是否可以“键入” redis?还是我需要离开它untyped
?
谢谢
I am working in .rbs
files in ruby and I and everything were working inside my app until I decided to declare the Redis
type in the .rbs
file.
I am using the gemfile redis
and then I have this function:
def redis_connect
Redis.new(host: REDIS_HOST, port: REDIS_PORT, password: REDIS_PASSWORD)
end
which in the .rbs
file looks like the next:
def redis_connect: () -> Redis
But I am getting the error cannot find Redis
is it possible to "type" Redis? or do I need to leave it untyped
?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论