Class: Bbs::Shitaraba::Board
- Defined in:
- lib/bbiff/bbs_reader.rb
Overview
したらば板
Instance Attribute Summary
Attributes inherited from BoardBase
Class Method Summary collapse
Instance Method Summary collapse
- #create_thread_from_line(line) ⇒ Object
- #dat_url(thread_num) ⇒ Object
-
#initialize(category, board_num) ⇒ Board
constructor
A new instance of Board.
Methods inherited from BoardBase
#dat, #settings, #thread, #thread_list, #threads
Constructor Details
#initialize(category, board_num) ⇒ Board
Returns a new instance of Board.
230 231 232 233 234 235 236 |
# File 'lib/bbiff/bbs_reader.rb', line 230 def initialize(category, board_num) super('EUC-JP') @category = category @board_num = board_num @settings_url = URI.parse( "http://jbbs.shitaraba.net/bbs/api/setting.cgi/#{category}/#{board_num}/" ) @thread_list_url = URI.parse( "http://jbbs.shitaraba.net/#{category}/#{board_num}/subject.txt" ) end |
Class Method Details
.from_url(url) ⇒ Object
217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/bbiff/bbs_reader.rb', line 217 def from_url(url) if url.to_s =~ SHITARABA_BOARD_TOP_URL_PATTERN category, board_num = $1, $2.to_i return Board.send(:new, category, board_num) elsif url.to_s =~ SHITARABA_THREAD_URL_PATTERN category, board_num, thread_num = $1, $2.to_i, $3.to_i return Board.send(:new, category, board_num) else return nil end end |
Instance Method Details
#create_thread_from_line(line) ⇒ Object
242 243 244 |
# File 'lib/bbiff/bbs_reader.rb', line 242 def create_thread_from_line(line) Thread.from_line(line, self) end |
#dat_url(thread_num) ⇒ Object
238 239 240 |
# File 'lib/bbiff/bbs_reader.rb', line 238 def dat_url(thread_num) return URI.parse("http://jbbs.shitaraba.net/bbs/rawmode.cgi/#{@category}/#{@board_num}/#{thread_num}/") end |