Sha256: c168236f3946dee6d54524b1b2f8566b4273c9e69a70f3dc32b2ec9e4b340c55
Contents?: true
Size: 493 Bytes
Versions: 2
Compression:
Stored size: 493 Bytes
Contents
require 'lita' require 'sicuro' module Lita module Handlers class Eval < Handler route %r{\Aeval\s(.+)}i, :evaluate, command: true, help: { 'eval CODE' => 'Evaluates the given ruby code.' } def evaluate(response) code = response.matches[0][0] response.reply Sicuro.eval("p(#{code})").to_s.strip rescue response.reply 'Sorry, I was unable to evaluate the given code.' end end Lita.register_handler(Eval) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lita-eval-0.0.2 | lib/lita/handlers/eval.rb |
lita-eval-0.0.1 | lib/lita/handlers/eval.rb |