Class: Bbs::Nichan::Board

Inherits:
BoardBase show all
Defined in:
lib/bbiff/bbs_reader.rb

Overview

2ちゃん板

Instance Attribute Summary

Attributes inherited from BoardBase

#settings_url

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BoardBase

#dat, #settings, #thread, #thread_list, #threads

Constructor Details

#initialize(hostname, port, name) ⇒ Board

Returns a new instance of Board.



315
316
317
318
319
320
321
# File 'lib/bbiff/bbs_reader.rb', line 315

def initialize(hostname, port, name)
  super('CP932')
  @hostname, @port, @name = hostname, port, name

  @settings_url = URI.parse("http://#{hostname}:#{port}/#{name}/SETTING.TXT")
  @thread_list_url = URI.parse("http://#{hostname}:#{port}/#{name}/subject.txt")
end

Class Method Details

.from_url(url) ⇒ Object



307
308
309
310
311
312
# File 'lib/bbiff/bbs_reader.rb', line 307

def from_url(url)
  uri = URI.parse(url)
  board_name = uri.path.split('/').reject(&:empty?).first
  return nil if board_name.nil?
  Board.send(:new, uri.hostname, uri.port, board_name)
end

Instance Method Details

#create_thread_from_line(line) ⇒ Object



327
328
329
# File 'lib/bbiff/bbs_reader.rb', line 327

def create_thread_from_line(line)
  Thread.from_line(line, self)
end

#dat_url(thread_num) ⇒ Object



323
324
325
# File 'lib/bbiff/bbs_reader.rb', line 323

def dat_url(thread_num)
  "http://#{@hostname}:#{@port}/#{@name}/dat/#{thread_num}.dat"
end