Class: Ruboty::ExecCommand::Actions::Command

Inherits:
Actions::Base
  • Object
show all
Defined in:
lib/ruboty/exec_command/actions/command.rb

Instance Method Summary collapse

Instance Method Details

#callObject



5
6
7
8
9
# File 'lib/ruboty/exec_command/actions/command.rb', line 5

def call
  # TODO: add timeout
  extension = Ruboty::ExecCommand::Command.new(command_args: command_body)
  message.reply(extension.run.chomp)
end

#command_bodyObject



15
16
17
# File 'lib/ruboty/exec_command/actions/command.rb', line 15

def command_body
  message.body.sub(robot_prefix_pattern,'')
end

#robot_prefix_patternObject



11
12
13
# File 'lib/ruboty/exec_command/actions/command.rb', line 11

def robot_prefix_pattern
  Ruboty::Action.prefix_pattern(message.original[:robot].name)
end