Class: Ruqqus::Comment

Inherits:
Submission show all
Defined in:
lib/ruqqus/types/comment.rb

Overview

Describes a comment in a post.

Instance Attribute Summary collapse

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

Methods inherited from Submission

#archived?, #deleted?, #edited?, #nsfl?, #nsfw?, #offensive?, #to_s

Methods inherited from ItemBase

#==, #banned?, from_json

Instance Attribute Details

#levelInteger (readonly)

Returns the level of "nesting" in the comment tree, starting at 1 when in direct reply to the post.

Returns:

  • (Integer)

    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_idString

Returns the unique ID of the parent for this comment.

Returns:

  • (String)

    the unique ID of the parent for this comment.



# File 'lib/ruqqus/types/comment.rb', line 12

#post_idString (readonly)

Returns the ID of the post this comment belongs to.

Returns:

  • (String)

    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.

Returns:

  • (Boolean)

    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.

Returns:

  • (Boolean)

    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