Class: Itest5ch::BoardListPage
- Inherits:
-
Object
- Object
- Itest5ch::BoardListPage
- Includes:
- HttpMethods
- Defined in:
- lib/itest5ch/board_list_page.rb
Constant Summary collapse
- BOARDS_URL =
"http://itest.5ch.net/".freeze
Instance Method Summary collapse
-
#all ⇒ Hash<String, Array<Itest5ch::Board>>
Get all boards.
Methods included from HttpMethods
Instance Method Details
#all ⇒ Hash<String, Array<Itest5ch::Board>>
Get all boards
10 11 12 13 14 15 16 17 18 |
# File 'lib/itest5ch/board_list_page.rb', line 10 def all doc = Hpricot(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_name = ul.at("/li[@class='pure-menu-item pure-menu-selected']").inner_text.strip categories[category_name] = get_boards(ul) end end |