2013-08-07 89 views
-3

現在,我有以下幾點:把兩個字符串變成紅寶石哈希?

<% @headlines.css('a').each do | headline | %> 
    <%= headline.text %> 
<% end %> 

<% @top_stories.css('a').each do | top_story | %> 
    <%= top_story.text %> 
<% end %> 

Nokogiri代碼)

它輸出這樣的:

" 
    Heat vs. Bulls, Lakers vs. Clippers on opening night 

    Free Agent Tracker 

    Player movement 
" 

" 

" 
    Heat-Bulls, Lakers-Clippers on opening night 

    Closer look at sked 

    Most intriguing 

    Official release 

    Suns' Beasley arrested for suspected drugs 
" 

我想談談這兩個字符串爲紅寶石哈希值。就像這樣:

{:headlines => ['Kobe ahead of schedule'], etc etc, :top_stories: ['Ex-Lebron pest Stevenson pinning to join Heat', etc etc] } 

如何做到這一點?

回答

1
​​