Class: Simple2ch::Board
- Inherits:
-
Object
- Object
- Simple2ch::Board
- Defined in:
- lib/simple2ch/board.rb
Instance Attribute Summary collapse
-
#board_name ⇒ String
readonly
板の名前(コンピュータ名).
-
#server_name ⇒ String
readonly
サーバ名.
-
#title ⇒ String
readonly
板のタイトル.
-
#url ⇒ URI
readonly
板のURL.
Instance Method Summary collapse
-
#initialize(title, url, fetch_title: nil) ⇒ Board
constructor
A new instance of Board.
-
#open2ch? ⇒ Boolean
おーぷん2chか否かを返す.
-
#thres ⇒ Array<Thre>
板に属する全てのスレッドを返す.
-
#type_of_2ch ⇒ Symbol
2chタイプ名の取得.
Constructor Details
#initialize(title, url, fetch_title: nil) ⇒ Board
Returns a new instance of Board.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/simple2ch/board.rb', line 16 def initialize(title, url, fetch_title:nil) @server_name = @board_name = nil @url = validate_url url @title = if fetch_title (b=Simple2ch.boards(url).find{|bb| bb.url.to_s == @url.to_s}) && b.class!=Array ? b.title : nil else title end @thres = [] end |
Instance Attribute Details
#board_name ⇒ String (readonly)
Returns 板の名前(コンピュータ名).
10 11 12 |
# File 'lib/simple2ch/board.rb', line 10 def board_name @board_name end |
#server_name ⇒ String (readonly)
Returns サーバ名.
8 9 10 |
# File 'lib/simple2ch/board.rb', line 8 def server_name @server_name end |
#title ⇒ String (readonly)
Returns 板のタイトル.
6 7 8 |
# File 'lib/simple2ch/board.rb', line 6 def title @title end |
#url ⇒ URI (readonly)
Returns 板のURL.
4 5 6 |
# File 'lib/simple2ch/board.rb', line 4 def url @url end |
Instance Method Details
#open2ch? ⇒ Boolean
おーぷん2chか否かを返す
39 40 41 |
# File 'lib/simple2ch/board.rb', line 39 def open2ch? @f_open2ch && true end |
#thres ⇒ Array<Thre>
板に属する全てのスレッドを返す
29 30 31 32 33 34 35 |
# File 'lib/simple2ch/board.rb', line 29 def thres if @thres.size > 0 @thres else fetch_all_thres end end |
#type_of_2ch ⇒ Symbol
2chタイプ名の取得
45 46 47 |
# File 'lib/simple2ch/board.rb', line 45 def type_of_2ch Simple2ch.type_of_2ch(@url.to_s) end |