module TokuSub
Public Class Methods
get(weekday)
click to toggle source
# File lib/tokusub.rb, line 6 def get(weekday) get_index[weekday.to_sym] end
Also aliased as: []
get_index()
click to toggle source
# File lib/tokusub.rb, line 16 def get_index # get tokusub page tokusub_page = Nokogiri::HTML(open('http://www.subway.co.jp/campaign/tokusub/')) h = Hash::new # index tokusubs 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