Module: Gitlab::Chat::Responder

Defined in:
lib/gitlab/chat/responder.rb,
lib/gitlab/chat/responder/base.rb,
lib/gitlab/chat/responder/slack.rb,
lib/gitlab/chat/responder/mattermost.rb

Defined Under Namespace

Classes: Base, Mattermost, Slack

Class Method Summary collapse

Class Method Details

.responder_for(build) ⇒ Object

Returns an instance of the responder to use for generating chat responses.

This method will return `nil` if no formatter is available for the given build.

build - A `Ci::Build` that executed a chat command.


13
14
15
16
17
18
19
# File 'lib/gitlab/chat/responder.rb', line 13

def self.responder_for(build)
  service = build.pipeline.chat_data&.chat_name&.service

  if (responder = service.try(:chat_responder))
    responder.new(build)
  end
end