Class: ProconBypassMan::SendWarningCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/procon_bypass_man/commands/send_warning_command.rb

Class Method Summary collapse

Class Method Details

.execute(warning:, stdout: true) ⇒ void

This method returns an undefined value.

Parameters:

  • warning (String, Hash, Exception)


4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/procon_bypass_man/commands/send_warning_command.rb', line 4

def self.execute(warning: , stdout: true)
  body =
    case warning
    when String, Hash
      warning
    else
      warning.full_message
    end

  ProconBypassMan.logger.warn body
  puts body if stdout

  ProconBypassMan::ReportWarningJob.perform(warning)
end