Module: KanpouWatcher

Defined in:
lib/kanpou-watcher.rb,
lib/kanpou-watcher/version.rb

Defined Under Namespace

Modules: VERSION Classes: Kanpou

Class Method Summary collapse

Class Method Details

.weekObject

Returns a list of KanpouWatcher::Kanpou objects published in this week.



42
43
44
45
46
47
48
49
# File 'lib/kanpou-watcher.rb', line 42

def self.week
  uri = URI.parse("http://kanpou.npb.go.jp/html/contents.html")
  list = Array.new
  (Hpricot(uri.read)/"td/p/a").each do |link|
    list << Kanpou.new(uri + link[:href], link.inner_text.toutf8)
  end
  return list
end