Class: Del::SendMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/del/send_message.rb

Instance Method Summary collapse

Constructor Details

#initialize(shell, socket_file:) ⇒ SendMessage

Returns a new instance of SendMessage.



5
6
7
8
# File 'lib/del/send_message.rb', line 5

def initialize(shell, socket_file:)
  @shell = shell
  @socket = SocketMessage.new(@shell, socket_file: socket_file)
end

Instance Method Details

#run(jid, message) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/del/send_message.rb', line 10

def run(jid, message)
  @socket.deliver(
    command: :send_message,
    jid: jid,
    message: message
  )
  @shell.say(@socket.listen, :green)
ensure
  @socket.close
end