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, NotA2chUrlException, Res, Simple2chException, Thre
Constant Summary
- DEBUG =
false
- VERSION =
"0.1.1"
Class Method Summary (collapse)
-
+ (String) fetch(url)
HTTPでGETする.
- + (Object) root
Class Method Details
+ (String) fetch(url)
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 |
+ (Object) root
16 17 18 |
# File 'lib/simple2ch.rb', line 16 def self.root File.dirname __dir__ end |