Sha256: ef4b4f6f9c36142ce1e39c97034298e5a575edc532a5a1cab235b9d8617a47d7
Contents?: true
Size: 891 Bytes
Versions: 5
Compression:
Stored size: 891 Bytes
Contents
require 'kconv' # #Board of 2ch.net # class Mona::Board attr_reader :host, :board # #=== initialize method # #_host_:: subdomain #_board_:: board name # #==== example #if you want to access http://hayabusa2.2ch.net/news4vip/ # Mona::Board.new('hayabusa2', 'news4vip') def initialize(host, board) @host = host @board = board end # #=== get threads # #array of Thread # def threads @threads ||= connect.toutf8.lines.map do |line| _, id, title, res_num = line.split(/^(\d+)\.dat<>(.+)\((\d+\))$/) Mona::Thread.new(board: self, title: title.strip, res_num: res_num.to_i, id: id.to_i) end end private # #=== url for subject.txt # def dat_url "http://#{@host}/#{@board}/subject.txt" end def connect res = Mona::Client.new.get(dat_url) if res.status == 200 res.content.toutf8 end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
mona-0.4.0 | lib/mona/board.rb |
mona-0.3.0 | lib/mona/board.rb |
mona-0.2.1 | lib/mona/board.rb |
mona-0.2.0 | lib/mona/board.rb |
mona-0.1.0 | lib/mona/board.rb |