17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/tokusub.rb', line 17
def get_index
tokusub_page = Nokogiri::HTML(open('http://www.subway.co.jp/campaign/tokusub/'))
h = Hash::new
tokusub_page.css('li a img').each do |img|
if img['src'] =~ /^images\/top_menu0/ then
case img['src']
when 'images/top_menu01.jpg'
h.store(:mon, img['alt'])
when 'images/top_menu02.jpg'
h.store(:tue, img['alt'])
when 'images/top_menu03.jpg'
h.store(:wed, img['alt'])
when 'images/top_menu04.jpg'
h.store(:thu, img['alt'])
when 'images/top_menu05.jpg'
h.store(:fri, img['alt'])
when 'images/top_menu06.jpg'
h.store(:sat, img['alt'])
when 'images/top_menu07.jpg'
h.store(:sun, img['alt'])
end
end
end
h
end
|