Module: Simple2ch
- Defined in:
- lib/simple2ch.rb,
lib/simple2ch/dat.rb,
lib/simple2ch/res.rb,
lib/simple2ch/thre.rb,
lib/simple2ch/board.rb,
lib/simple2ch/version.rb,
lib/simple2ch/simple2ch_exception.rb
Defined Under Namespace
Classes: Board, Dat, DatParseException, KakoLogException, NoThreGivenException, NotA2chUrlException, Res, Simple2chException, Thre
Constant Summary collapse
- DEBUG =
false- VERSION =
"0.1.3"
Class Method Summary collapse
-
.fetch(url) ⇒ String
HTTPでGETする.
- .root ⇒ Object
Class Method Details
.fetch(url) ⇒ String
HTTPでGETする
23 24 25 26 27 28 29 |
# File 'lib/simple2ch.rb', line 23 def self.fetch(url) req = Net::HTTP::Get.new(url.path) res = Net::HTTP.start(url.host, url.port) {|http| http.request(req) } res.body.force_encoding("cp932").encode!('utf-8', :undef => :replace) end |
.root ⇒ Object
16 17 18 |
# File 'lib/simple2ch.rb', line 16 def self.root File.dirname __dir__ end |