Sha256: 9f52a4247bf56e8ee20c29740c8d4c433ec6e9766f48fd0980e8dfd3e6f7b943

Contents?: true

Size: 542 Bytes

Versions: 1

Compression:

Stored size: 542 Bytes

Contents

# frozen_string_literal: true
require "slack-notify"

module KapostDeploy
  module Slack
    # Wrapper for slack-notify gem
    class Notifier
      def initialize(slack_config)
        self.slack_config = slack_config
      end

      def notify(message)
        return unless configured?
        slack.notify(message)
      end

      def configured?
        !slack_config.nil?
      end

      private

      def slack
        @slack ||= SlackNotify::Client.new(slack_config)
      end

      attr_accessor :slack_config
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kapost_deploy-0.2.0 lib/kapost_deploy/slack/notifier.rb