Class: Ruqqus::Comment
- Inherits:
-
Submission
- Object
- ItemBase
- Submission
- Ruqqus::Comment
- Defined in:
- lib/ruqqus/types/comment.rb
Overview
Describes a comment in a post.
Instance Attribute Summary collapse
-
#level ⇒ Integer
readonly
The level of "nesting" in the comment tree, starting at
1
when in direct reply to the post. -
#parent_id ⇒ String
The unique ID of the parent for this comment.
-
#post_id ⇒ String
readonly
The ID of the post this comment belongs to.
Attributes inherited from Submission
#author_name, #body, #body_html, #downvotes, #fullname, #guild_name, #last_edit, #last_edit_utc, #score, #title, #upvotes
Attributes inherited from ItemBase
#created, #created_utc, #id, #permalink
Instance Method Summary collapse
-
#parent_comment? ⇒ Boolean
true
if the comment's parent is comment, otherwisefalse
if it is a post. -
#parent_post? ⇒ Boolean
true
if the comment's parent is post, otherwisefalse
if it is a comment.
Methods inherited from Submission
#archived?, #deleted?, #edited?, #nsfl?, #nsfw?, #offensive?, #to_s
Methods inherited from ItemBase
Instance Attribute Details
#level ⇒ Integer (readonly)
Returns the level of "nesting" in the comment tree, starting at 1
when in direct reply to the post.
|
# File 'lib/ruqqus/types/comment.rb', line 8
|
#parent_id ⇒ String
Returns the unique ID of the parent for this comment.
|
# File 'lib/ruqqus/types/comment.rb', line 12
|
#post_id ⇒ String (readonly)
Returns the ID of the post this comment belongs to.
|
# File 'lib/ruqqus/types/comment.rb', line 16
|
Instance Method Details
#parent_comment? ⇒ Boolean
Returns true
if the comment's parent is comment, otherwise false
if it is a post.
22 23 24 |
# File 'lib/ruqqus/types/comment.rb', line 22 def parent_comment? level > 1 end |
#parent_post? ⇒ Boolean
Returns true
if the comment's parent is post, otherwise false
if it is a comment.
28 29 30 |
# File 'lib/ruqqus/types/comment.rb', line 28 def parent_post? level == 1 end |