class Del::Message

An XMPP Message

Constants

PREFIX

Attributes

robot[R]
source[R]
text[R]

Public Class Methods

new(text, robot:, source:) click to toggle source
# File lib/del/message.rb, line 9
def initialize(text, robot:, source:)
  @text = text
  @robot = robot
  @source = source
end

Public Instance Methods

execute_shell(command) { |line| ... } click to toggle source
# File lib/del/message.rb, line 19
def execute_shell(command)
  reply("Okay, I'm on it!")
  ShellCommand.new(command).run do |line|
    if block_given?
      yield line
    else
      reply("#{PREFIX} #{line}")
    end
  end
end
reply(message) click to toggle source
# File lib/del/message.rb, line 15
def reply(message)
  source.reply(robot, message)
end
to_s() click to toggle source
# File lib/del/message.rb, line 30
def to_s
  "#{source}: #{text}"
end