class Fourchan::Kit::Thread
Thread is used to deal with a thread from a board.
Attributes
board[R]
thread[R]
Public Class Methods
new(board, thread)
click to toggle source
# File lib/fourchan/kit/thread.rb, line 9 def initialize(board, thread) @posts = [] @board = board @thread = API.get_thread(board, thread) end
Public Instance Methods
fetch_replies()
click to toggle source
Get all replies from the thread. OP is not included.
It then returns the replies.
# File lib/fourchan/kit/thread.rb, line 35 def fetch_replies @posts = [] @thread = API.get_thread(@board, self.op.no) self.replies end
images()
click to toggle source
Returns an array of image URLs from the thread (see {Fourchan::Kit::Post#image_link}).
# File lib/fourchan/kit/thread.rb, line 49 def images images = [] self.posts.each do |post| images << post.image_link end images.compact end
op()
click to toggle source
Return only the first post from the thread.
# File lib/fourchan/kit/thread.rb, line 28 def op self.posts[0] end
posts()
click to toggle source
Returns all posts from the thread, including OP.
# File lib/fourchan/kit/thread.rb, line 17 def posts if @posts.empty? @thread.each do |post| @posts << Post.new(post, @board) end end @posts end
replies()
click to toggle source
Return all the replies. OP is not included.
# File lib/fourchan/kit/thread.rb, line 43 def replies self.posts[1..-1] end