Module: Bashim
- Defined in:
- lib/bashim.rb,
lib/bashim/version.rb
Constant Summary collapse
- VERSION =
"1.0.5"
Instance Method Summary collapse
Instance Method Details
#random ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/bashim.rb', line 6 def random html = Net::HTTP.get('bash.im', '/random') html.encode!('UTF-8', 'CP1251', :invalid => :replace, :replace => '') text = /\<div class=\"text\"\>.*?\<\/div\>/.match(html) cit = text.to_s cit.gsub!(/\<br.*?\>/,"\n") cit.gsub!(/"/,"\"") cit.gsub!(/</,"<") cit.gsub!(/>/,">") return cit.gsub(/\<.+?\>/,"") end |