Sha256: eb7f7c15cf36a3da6e55725dafd6fee52b7d9b70f2211a59f89204406a0589e8

Contents?: true

Size: 648 Bytes

Versions: 6

Compression:

Stored size: 648 Bytes

Contents

require 'highline/import'
require_relative "../notify_slack"
require_relative "../random_message"

module SlackMessaging
  module Scripts
    class Slack
      class << self
        attr_accessor :options
      end

      def self.execute(args, options=nil)
        if args.empty?
          message = RandomMessage.new # generate a new random message
          print_message(message.get_text)
        else
          args.each do |message|
            print_message(message)
          end
        end
      end

      def self.print_message(message)
        slack_job = NotifySlack.new(message)
        slack_job.perform
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
slack_messaging-1.3.0 lib/slack_messaging/scripts/slack.rb
slack_messaging-1.2.1 lib/slack_messaging/scripts/slack.rb
slack_messaging-1.2.0 lib/slack_messaging/scripts/slack.rb
slack_messaging-1.1.0 lib/slack_messaging/scripts/slack.rb
slack_messaging-1.0.1 lib/slack_messaging/scripts/slack.rb
slack_messaging-1.0.0 lib/slack_messaging/scripts/slack.rb