Method: Itest5ch::BoardListPage#all

Defined in:
lib/itest5ch/board_list_page.rb

#allHash<String, Array<Itest5ch::Board>>

Get all boards



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/itest5ch/board_list_page.rb', line 10

def all
  doc = Nokogiri::HTML.parse(get_html(BOARDS_URL))

  doc.search("//div[@id='bbsmenu']//ul[@class='pure-menu-list']").
    reject {|ul| ul["id"] == "history" }.each_with_object({}) do |ul, categories|
    category_node = ul.at_xpath("li[contains(@class, 'pure-menu-item') and contains(@class, 'pure-menu-selected')]")
    next unless category_node

    category_name = category_node.text.strip

    categories[category_name] = get_boards(ul)
  end
end