Class: Hacker::News::CommentTreeNode
- Defined in:
- lib/hacker/news/items.rb
Overview
A comment tree node with recursively-fetched replies. Inherits from Comment so callers can use is_a?(Comment) / pattern matching uniformly on the whole tree.
Instance Attribute Summary collapse
-
#replies ⇒ Array<CommentTreeNode>
readonly
Child replies (already pruned of deleted nodes).
Attributes inherited from Comment
Attributes inherited from Item
Instance Method Summary collapse
-
#initialize(data, replies:) ⇒ CommentTreeNode
constructor
A new instance of CommentTreeNode.
Methods inherited from Comment
Methods inherited from Item
Constructor Details
#initialize(data, replies:) ⇒ CommentTreeNode
Returns a new instance of CommentTreeNode.
151 152 153 154 |
# File 'lib/hacker/news/items.rb', line 151 def initialize(data, replies:) super(data) @replies = replies end |
Instance Attribute Details
#replies ⇒ Array<CommentTreeNode> (readonly)
Returns child replies (already pruned of deleted nodes).
147 148 149 |
# File 'lib/hacker/news/items.rb', line 147 def replies @replies end |