Class: Greentext::Post
Overview
Public: (Model) A 4chan post in a thread.
Instance Attribute Summary collapse
-
#board ⇒ Object
readonly
Returns the value of attribute board.
-
#capcode_replies ⇒ Object
readonly
Returns the value of attribute capcode_replies.
-
#com ⇒ Object
readonly
Returns the value of attribute com.
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#country_name ⇒ Object
readonly
Returns the value of attribute country_name.
-
#custom_spoiler ⇒ Object
readonly
Returns the value of attribute custom_spoiler.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#images ⇒ Object
readonly
Returns the value of attribute images.
-
#no ⇒ Object
readonly
Returns the value of attribute no.
-
#omitted_images ⇒ Object
readonly
Returns the value of attribute omitted_images.
-
#omitted_posts ⇒ Object
readonly
Returns the value of attribute omitted_posts.
-
#replies ⇒ Object
readonly
Returns the value of attribute replies.
-
#resto ⇒ Object
readonly
Returns the value of attribute resto.
-
#semantic_url ⇒ Object
readonly
Returns the value of attribute semantic_url.
-
#sub ⇒ Object
readonly
Returns the value of attribute sub.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
-
#trip ⇒ Object
readonly
Returns the value of attribute trip.
Attributes inherited from Base
Instance Method Summary collapse
- #expand ⇒ Object
-
#image ⇒ Object
Public: Get information about the image attached to the post.
-
#op? ⇒ Boolean
Public: Determines if the post is OP.
-
#thumbnail ⇒ Object
Public: Get information about the thumbnail of the image.
Methods inherited from Base
attr_epoch, attr_predicate, attr_reader, #initialize
Constructor Details
This class inherits a constructor from Greentext::Base
Instance Attribute Details
#board ⇒ Object (readonly)
Returns the value of attribute board.
8 9 10 |
# File 'lib/greentext/post.rb', line 8 def board @board end |
#capcode_replies ⇒ Object (readonly)
Returns the value of attribute capcode_replies.
25 26 27 |
# File 'lib/greentext/post.rb', line 25 def capcode_replies @capcode_replies end |
#com ⇒ Object (readonly)
Returns the value of attribute com.
19 20 21 |
# File 'lib/greentext/post.rb', line 19 def com @com end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
19 20 21 |
# File 'lib/greentext/post.rb', line 19 def comment @comment end |
#country ⇒ Object (readonly)
Returns the value of attribute country.
15 16 17 |
# File 'lib/greentext/post.rb', line 15 def country @country end |
#country_name ⇒ Object (readonly)
Returns the value of attribute country_name.
16 17 18 |
# File 'lib/greentext/post.rb', line 16 def country_name @country_name end |
#custom_spoiler ⇒ Object (readonly)
Returns the value of attribute custom_spoiler.
20 21 22 |
# File 'lib/greentext/post.rb', line 20 def custom_spoiler @custom_spoiler end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
17 18 19 |
# File 'lib/greentext/post.rb', line 17 def email @email end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
14 15 16 |
# File 'lib/greentext/post.rb', line 14 def id @id end |
#images ⇒ Object (readonly)
Returns the value of attribute images.
24 25 26 |
# File 'lib/greentext/post.rb', line 24 def images @images end |
#no ⇒ Object (readonly)
Returns the value of attribute no.
6 7 8 |
# File 'lib/greentext/post.rb', line 6 def no @no end |
#omitted_images ⇒ Object (readonly)
Returns the value of attribute omitted_images.
22 23 24 |
# File 'lib/greentext/post.rb', line 22 def omitted_images @omitted_images end |
#omitted_posts ⇒ Object (readonly)
Returns the value of attribute omitted_posts.
21 22 23 |
# File 'lib/greentext/post.rb', line 21 def omitted_posts @omitted_posts end |
#replies ⇒ Object (readonly)
Returns the value of attribute replies.
23 24 25 |
# File 'lib/greentext/post.rb', line 23 def replies @replies end |
#resto ⇒ Object (readonly)
Returns the value of attribute resto.
7 8 9 |
# File 'lib/greentext/post.rb', line 7 def resto @resto end |
#semantic_url ⇒ Object (readonly)
Returns the value of attribute semantic_url.
27 28 29 |
# File 'lib/greentext/post.rb', line 27 def semantic_url @semantic_url end |
#sub ⇒ Object (readonly)
Returns the value of attribute sub.
18 19 20 |
# File 'lib/greentext/post.rb', line 18 def sub @sub end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
18 19 20 |
# File 'lib/greentext/post.rb', line 18 def subject @subject end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
26 27 28 |
# File 'lib/greentext/post.rb', line 26 def tag @tag end |
#trip ⇒ Object (readonly)
Returns the value of attribute trip.
13 14 15 |
# File 'lib/greentext/post.rb', line 13 def trip @trip end |
Instance Method Details
#image ⇒ Object
Public: Get information about the image attached to the post.
Returns a Hash.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/greentext/post.rb', line 41 def image if @attrs["tim"] { width: @attrs["w"], height: @attrs["h"], filename: @attrs["tim"], md5: @attrs["md5"], url: "https://i.4cdn.org/#{@attrs['board'].name}/" \ "#{@attrs['tim']}#{@attrs['ext']}" } else {} end end |
#op? ⇒ Boolean
Public: Determines if the post is OP.
Returns a Boolean value.
73 74 75 |
# File 'lib/greentext/post.rb', line 73 def op? @attrs["resto"] == 0 end |
#thumbnail ⇒ Object
Public: Get information about the thumbnail of the image.
Returns a Hash.
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/greentext/post.rb', line 59 def thumbnail if @attrs["tim"] { width: @attrs["tn_w"], height: @attrs["tn_h"], url: "https://t.4cdn.org/#{@attrs['board'].name}/" \ "#{@attrs['tim']}s.jpg" } else {} end end |