gitlab-org--gitlab-foss/lib/gitlab/chat/responder.rb
James Fargher 2d19b1adef Move ChatOps to Core
ChatOps used to be in the Ultimate tier.
2019-02-20 21:29:48 +00:00

22 lines
568 B
Ruby

# frozen_string_literal: true
module Gitlab
module Chat
module Responder
# 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.
def self.responder_for(build)
service = build.pipeline.chat_data&.chat_name&.service
if (responder = service.try(:chat_responder))
responder.new(build)
end
end
end
end
end