class TelegramMeetupBot::Commands::CalCommand

Public Instance Methods

exec() click to toggle source
# File lib/telegram_meetup_bot/commands/cal_command.rb, line 4
def exec
  dates = Calendar.submited_days_of_month(month)
  list_response(list: dates, month: month_with_year)
end

Private Instance Methods

month() click to toggle source
# File lib/telegram_meetup_bot/commands/cal_command.rb, line 11
def month
  @month ||= ParamsParser.new(params.first).parse_month if params.any?
  @month ||= Date.today.month
  @month
end
month_with_year() click to toggle source
# File lib/telegram_meetup_bot/commands/cal_command.rb, line 17
def month_with_year
  today = Date.today
  year = month < today.month ? today.next_year.year : today.year
  Date.new(year, month)
end