Created
March 20, 2014 16:10
-
-
Save kazoo04/9667425 to your computer and use it in GitHub Desktop.
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
# encoding: utf-8 | |
require 'date' | |
@dic = {'朝' => 'first', '昼' => 'second', '夜' => 'third'} | |
def meshi(str) | |
today = Date.today | |
@dic.each{ |key, value| | |
next unless str.include?("@hogehoge #{key}") | |
message = "(./#{value}.txt)" | |
if str.include?('明') | |
if today.day == Date.new(today.year, today.month, -1).day | |
message += "今日は月末です" | |
else | |
message += "#{today.day + 1}日 の献立を表示" | |
end | |
else | |
message += "#{today.day}日 の献立を表示" | |
end | |
return message | |
} | |
return "" | |
end | |
puts meshi('@hogehoge 朝 今日') | |
puts meshi('@hogehoge 昼 今日') | |
puts meshi('@hogehoge 夜 明日') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment