Created
September 8, 2015 07:31
-
-
Save moonhouse/d01b335093af2440114c to your computer and use it in GitHub Desktop.
Ta fram dagens meny från Pontus utifrån deras meny-PDF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'pdf-reader' | |
| weekdays = %w{Söndag Måndag Tisdag Onsdag Torsdag Fredag Lördag} | |
| reader = PDF::Reader.new("P4_V.37.-15.pdf") | |
| page = reader.pages.first | |
| week_menu = {} | |
| week_menu.default = '' | |
| current_weekday = '' | |
| page.text.each_line do |line| | |
| if weekdays.include? line.strip | |
| current_weekday = line.strip | |
| elsif line.strip.length > 0 | |
| week_menu[current_weekday] += line | |
| end | |
| end | |
| today = weekdays[Time.now.wday] | |
| puts "*Meny #{today.downcase}* (Pontus)" | |
| puts week_menu[today] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment