Sha256: edfe3d890c3d56683796b3d8d6bb51939b1eaeaa7cc99bd35d17247da603d085
Contents?: true
Size: 628 Bytes
Versions: 1
Compression:
Stored size: 628 Bytes
Contents
require 'lita' require 'net/http' require 'cgi' module Lita module Handlers class Bor < Handler route(/^bor/, :bor) # Some implementation based on Rebular Expressions. # TODO: use Nokogiri or an other HTML parser. def bor(response) str = Net::HTTP.get(URI('http://bash.im/forweb/?u')) str = str.gsub(/'\s+\+\s+'/, '') str = str.match(/<div id="b_q_t" [^>]+>(.+?)<\/div>/)[1] str = str.gsub(/<br[^>]*>/, "\n") str = CGI.unescapeHTML(str) str = "#{str}\n" response.reply(str) end end Lita.register_handler(Bor) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lita-bor-0.0.1 | lib/lita/handlers/bor.rb |