class Ruboty::Actions::Ragoon::Event

Public Instance Methods

call() click to toggle source
# File lib/ruboty/actions/ragoon/event.rb, line 5
def call
  target_date = parse_date(message[:date])
  events = ::Ruboty::Ragoon::Event.new(target_date)
  message.reply(events.render(private: private?))
end

Private Instance Methods

parse_date(date) click to toggle source
# File lib/ruboty/actions/ragoon/event.rb, line 13
def parse_date(date)
  date = date.strip.downcase
  case date
  when 'today'
    Date.today
  when 'tomorrow'
    Date.today + 1
  when 'yesterday'
    Date.today - 1
  else
    Date.parse(date)
  end
rescue
  Date.today
end