Class: Lita::Handlers::Eval
- Inherits:
-
Handler
- Object
- Handler
- Lita::Handlers::Eval
- Defined in:
- lib/lita/handlers/eval.rb
Instance Method Summary collapse
Instance Method Details
#evaluate(response) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/lita/handlers/eval.rb', line 10 def evaluate(response) code = response.matches[0][0] http_response = http.post 'http://eval.so/api/evaluate' do |req| req.headers['Content-Type'] = 'application/json' req.body = MultiJson.dump(language: 'ruby', code: "p(#{code})") end response.reply MultiJson.load(http_response.body)['stdout'].strip end |