Class: Fourchan::Kit::Post

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/fourchan/kit/post.rb

Overview

Post should make it easy to use OpenStruct for posts in a thread.

Also make it possible to get the link for the image, if the post has one.

Instance Method Summary (collapse)

Constructor Details

- (Post) initialize(hash, board)

Returns a new instance of Post



10
11
12
13
# File 'lib/fourchan/kit/post.rb', line 10

def initialize(hash, board)
  super(hash)
  @board = board
end

Instance Method Details

Return an URL for the image (if user submitted an image).

Returns:

  • (URL)

    the URL for the image.



19
20
21
# File 'lib/fourchan/kit/post.rb', line 19

def image_link
  "http://i.4cdn.org/#{@board}/#{self.tim}#{self.ext}" if self.tim
end