Class: Lita::Handlers::Bor
- Inherits:
-
Handler
- Object
- Handler
- Lita::Handlers::Bor
- Defined in:
- lib/lita/handlers/bor.rb
Instance Method Summary collapse
-
#bor(response) ⇒ Object
Some implementation based on Rebular Expressions.
Instance Method Details
#bor(response) ⇒ Object
Some implementation based on Rebular Expressions. TODO: use Nokogiri or an other HTML parser.
12 13 14 15 16 17 18 19 20 |
# File 'lib/lita/handlers/bor.rb', line 12 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 |