module Sirius

Top level module for Sirius

Warning

All methods throws Exception

Wow!

Possible call methods for each board

Example

# Returns pages count
Sirius::PR::pages     # => 20
# Returns all threads
Sirius::PR::page      # => [<Thread>...<Thread>]
# Returns all posts from thread
Sirius::PR::thread(1) # => [<Post>...<Posts>]

Constants

TIME

Default time for request

URL

Default URL for request

VERSION

Public Instance Methods

page(board, page_num = nil) click to toggle source

Get all threads from page. Return Array of threads for board from page.

Attributes

  • board - board for request

  • page_num - page_num, default is ‘nil`[wakaba page or 0]

Example

# Return all threads from 0 page for `pr`
Sirius::page('pr')   #=> [<Thread>...<Thread>]
# For `b`, 1st page
Sirius::page('b', 1) #=> [<Thread>...<Thread>]
# File lib/sirius.rb, line 68
def page(board, page_num = nil)
  get(board, page_num)[:threads].inject([]){|m, z| m << Thread.new(z.merge({:board => board})) }
end
Also aliased as: threads
pages(board) click to toggle source

Get count pages for board Return Fixnum

Attributes

  • board - board for request

Example

# Return pages count from `pr`
Sirius::pages('pr')   #=> 20
# File lib/sirius.rb, line 113
def pages(board)
  get(board, 1)[:pages].size
end
thread(board, num) click to toggle source

Get all posts from thread Return Array of posts

Attributes

  • board - board

  • num - num of thread

Example

# Return all posts for 1st thread
Sirius::thread('pr', 1)  #=> [<Post>...<Post>]
# File lib/sirius.rb, line 97
def thread(board, num)
  get("#{board}/res", num)[:thread].inject([]){|m, z| m << Thread.new({:board => board, :posts => [z]}) }
end
threads(board, page_num = nil)

TODO

add #pages! method for get all pages from board
#pages get from CACHE
#pages! http-request for return page count.
Alias for: page