私が使用している宝石「twitter」は、次のメソッドを実行しようとすると、次の結果を提供しています。
def timeline
@mytimeline = Twitter.user_timeline("cnn")
newstring = @mytimeline.to_s
puts newstring
end
#<Twitter::Tweet:0x00000001647390>
#<Twitter::Tweet:0x00000001647368>
#<Twitter::Tweet:0x00000001647340>
...
ハッシュ記号を介して結果にアクセスしようとしています。
.to_s を変換すると、ハッシュ全体の巨大なダンプを文字列で取得できます...
シンボルにアクセスする最も簡単な方法は何ですか? ここに私が得る結果があります:
[#<Twitter::Tweet:0x0000000210ba88
@attrs={
:created_at=>"Thu Sep 19 17:01:56 +0000 2013",
:id=>380738540914479104,
:id_str=>"380738540914479104",
:text=>"What if you could buy a smartphone that would last you for the rest of your life? http://t.co/3j5N9gz18H",
:source=>"web",
:truncated=>false,
:in_reply_to_status_id=>nil,
:in_reply_to_status_id_str=>nil,
...
}