Module: Edah

Defined in:
lib/module/edah.rb

Overview

義大醫療財團法人義大醫院

Class Method Summary collapse

Class Method Details

.crawlObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/module/edah.rb', line 3

def Edah.crawl
    hash = {}
    url = "http://www3.edah.org.tw/E-DA/WebRegister/ProcessEmeInf.jsp"
    begin
        html = open(url).read
        html.encode!("big5")
        page = Nokogiri::HTML.parse html
        hash[:hospital] = "edah"
        hash[:to_119]        = self.split(page.css("body table tr:nth-child(1) td font").text.strip)
        hash[:wait_see]      = self.split(page.css("body table tr:nth-child(2) td font").text.strip)
        hash[:wait_push_bed] = self.split(page.css("body table tr:nth-child(3) td font").text.strip)
        hash[:wait_bed]      = self.split(page.css("body table tr:nth-child(4) td font").text.strip)
        hash[:wait_cure_bed] = self.split(page.css("body table tr:nth-child(5) td font").text.strip)
    rescue Exception => e
        p e.message
        return nil
    end
    return hash
end

.split(text) ⇒ Object



23
24
25
# File 'lib/module/edah.rb', line 23

def self.split(text)
    return text.split("")[1]
end