def load_
.. comics = {} //宣告一個空 Ruby Hash :comics
.. File.forea ch(path) do |line | //開啟一個檔案,且一段一個區間,將每line
.... name,url=l ine.split( ':') //的文字,從‘:’分兩段,儲存於name與url
.... comics[nam e]=url.str ip //配對 name 與 url 至Hash
- //strip -- This quick method removes extra spaces around the url. Just in case.
.... end
沒有留言:
張貼留言