Class: Mona::Board
- Inherits:
-
Object
- Object
- Mona::Board
- Defined in:
- lib/mona/board.rb
Overview
Board of 2ch.net
Instance Attribute Summary collapse
-
#board ⇒ Object
readonly
Returns the value of attribute board.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
Instance Method Summary collapse
-
#initialize(host, board) ⇒ Board
constructor
initialize method.
-
#threads ⇒ Object
get threads.
Constructor Details
#initialize(host, board) ⇒ Board
initialize method
- host
-
subdomain
- board
-
board name
example
if you want to access hayabusa2.2ch.net/news4vip/ Mona::Board.new(‘hayabusa2’, ‘news4vip’)
18 19 20 21 |
# File 'lib/mona/board.rb', line 18 def initialize(host, board) @host = host @board = board end |
Instance Attribute Details
#board ⇒ Object (readonly)
Returns the value of attribute board.
7 8 9 |
# File 'lib/mona/board.rb', line 7 def board @board end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
7 8 9 |
# File 'lib/mona/board.rb', line 7 def host @host end |
Instance Method Details
#threads ⇒ Object
get threads
array of Thread
28 29 30 31 32 33 |
# File 'lib/mona/board.rb', line 28 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 |