【发布时间】:2013-07-03 14:08:49
【问题描述】:
我有返回下一个哈希对象的 gem
{:response=>"There was an error authenticating the sender account.", :status_code=>401}
在我的 rake 任务中,我正在尝试访问它的属性:
response = my_gem.execute
puts response
puts response.has_key?(:respose)
puts response[:respose]
但我不明白为什么会打印出来
{:response=>"There was an error authenticating the sender account.", :status_code=>401}
false
为什么我不能使用 response[:respose] 访问 :response 属性?
附: response[response.keys.first] 有效,但这是非常奇怪的解决方案
【问题讨论】:
-
这个问题似乎是题外话,因为它是关于一个错字/语法错误
标签: ruby-on-rails ruby gem rake