Skip to content

Instantly share code, notes, and snippets.

@erutaso
Forked from kazoo04/ginko_meshi.rb
Created March 20, 2014 16:17
Show Gist options
  • Save erutaso/9667595 to your computer and use it in GitHub Desktop.
Save erutaso/9667595 to your computer and use it in GitHub Desktop.
# 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