class TeamsIncomingClients::TargetDateClient
Public Instance Methods
post(text, target_days)
click to toggle source
指定した日付であればメッセージを送信する @return [PostResult] @param [String] text 送信するメッセージ @param [Array, Integer] target_days 送信したい日付。配列で複数条件を渡すことも可能 @example client.post(“hello world”, 25)
# File lib/teams_incoming_clients/models/target_date_client.rb, line 9 def post(text, target_days) if today_match_day?(target_days) post_message(text) else PostResult.new(false, :not_post, "Today is not #{target_days} day") end end
Private Instance Methods
today_match_day?(target_days)
click to toggle source
指定した日付がどうかを判定する
# File lib/teams_incoming_clients/models/target_date_client.rb, line 20 def today_match_day?(target_days) if target_days.is_a?(Array) target_days.one? {|target_day| today.today_match_day?(target_day) } else today.today_match_day?(target_days) end end