class Bbs::BoardBase

Attributes

settings_url[R]

Public Class Methods

new(text_encoding) click to toggle source
# File lib/bbiff/bbs_reader.rb, line 144
def initialize(text_encoding)
  @downloader = Downloader.new(text_encoding)
end

Public Instance Methods

create_thread_from_line(_line) click to toggle source

抽象メソッド

# File lib/bbiff/bbs_reader.rb, line 171
def create_thread_from_line(_line)
  raise 'unimplemented'
end
dat(thread_num) click to toggle source
# File lib/bbiff/bbs_reader.rb, line 160
def dat(thread_num)
  return download_text(dat_url(thread_num))
end
dat_url(_thread_num) click to toggle source
# File lib/bbiff/bbs_reader.rb, line 175
def dat_url(_thread_num)
  raise 'unimplemented'
end
settings() click to toggle source
# File lib/bbiff/bbs_reader.rb, line 152
def settings
  return parse_settings(download_text(@settings_url))
end
thread(thread_num) click to toggle source
# File lib/bbiff/bbs_reader.rb, line 148
def thread(thread_num)
  threads.find { |t| t.id == thread_num }
end
thread_list() click to toggle source
# File lib/bbiff/bbs_reader.rb, line 156
def thread_list
  return download_text(@thread_list_url)
end
threads() click to toggle source
# File lib/bbiff/bbs_reader.rb, line 164
def threads
  thread_list.each_line.map do |line|
    create_thread_from_line(line)
  end
end

Protected Instance Methods

download_binary(url) click to toggle source
# File lib/bbiff/bbs_reader.rb, line 181
def download_binary(url)
  @downloader.download_binary(url)
end
download_text(url) click to toggle source
# File lib/bbiff/bbs_reader.rb, line 185
def download_text(url)
  @downloader.download_text(url)
end
parse_settings(string) click to toggle source
# File lib/bbiff/bbs_reader.rb, line 189
def parse_settings(string)
  string.each_line.map { |line|
    line.chomp.split(/=/, 2)
  }.to_h
end