Class: Simple2ch::Board

Inherits:
Object
  • Object
show all
Defined in:
lib/simple2ch/board.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, title: nil) ⇒ Board

Returns a new instance of Board.

Parameters:

  • title (String) (defaults to: nil)

    板の名前

  • url (String)

    板のURL

  • [Boolean] (Hash)

    a customizable set of options



14
15
16
17
18
# File 'lib/simple2ch/board.rb', line 14

def initialize(url, title: nil)
  @url = validate_url(url)
  @title = title
  @updated_at = Time.now
end

Instance Attribute Details

#titleString (readonly)

Returns 板のタイトル.

Returns:

  • (String)

    板のタイトル



6
7
8
# File 'lib/simple2ch/board.rb', line 6

def title
  @title
end

#updated_atTime (readonly)

Returns 板オブジェクト更新日時.

Returns:

  • (Time)

    板オブジェクト更新日時



8
9
10
# File 'lib/simple2ch/board.rb', line 8

def updated_at
  @updated_at
end

#urlBbs2chUrlValidator::URL (readonly)

Returns 板のURL.

Returns:

  • (Bbs2chUrlValidator::URL)

    板のURL



4
5
6
# File 'lib/simple2ch/board.rb', line 4

def url
  @url
end

Instance Method Details

#==(other) ⇒ Object



26
27
28
# File 'lib/simple2ch/board.rb', line 26

def ==(other)
  @url.to_s == other.url.to_s
end

#threadsArray<Thre>

板に属する全てのスレッドを返す

Returns:

  • (Array<Thre>)

    板に属する全てのスレッド



22
23
24
# File 'lib/simple2ch/board.rb', line 22

def threads
  @threads ||= fetch_all_threads
end