Class: SlackMessaging::Slack

Inherits:
Object
  • Object
show all
Defined in:
lib/slack_messaging/slack.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/slack_messaging/slack.rb', line 6

def options
  @options
end

Class Method Details

.execute(args, options = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/slack_messaging/slack.rb', line 9

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


20
21
22
23
# File 'lib/slack_messaging/slack.rb', line 20

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