Sha256: fd91a1e5ebc52a76fc2e967a7e7117ec71fb2d48b314561c8caeaacea450420f
Contents?: true
Size: 532 Bytes
Versions: 1
Compression:
Stored size: 532 Bytes
Contents
require 'lita' 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] http_response = http.put 'http://tryruby.org/levels/1/challenges/0/play' do |req| req.body = {cmd: code} end response.reply MultiJson.load(http_response.body)['output'] end end Lita.register_handler(Eval) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lita-eval-0.2.0 | lib/lita/handlers/eval.rb |