Class: Itaiji::Fetcher
- Inherits:
-
Object
- Object
- Itaiji::Fetcher
- Defined in:
- lib/itaiji/fetcher.rb
Constant Summary collapse
- URL =
"https://wwwap.hi.u-tokyo.ac.jp/ships/itaiji_list.jsp"
Instance Method Summary collapse
Instance Method Details
#fetch ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/itaiji/fetcher.rb', line 8 def fetch doc = Nokogiri::HTML(open(URL)) itaiji_sets = doc.xpath("//tr[contains(@class, 'g') or contains(@class, 'w')]").map do |element| _, seijitai_element, itaiji_element = element.xpath(".//td") itaijis = itaiji_element.text.split(" ") Set.new(seijitai_element.text.strip, itaijis.take(itaijis.length - 1)) end List.new(itaiji_sets) end |