Class: Hacker::News::Comment

Inherits:
Item
  • Object
show all
Defined in:
lib/hacker/news/items.rb

Overview

A comment on a story, poll, or parent comment.

Direct Known Subclasses

CommentTreeNode

Instance Attribute Summary collapse

Attributes inherited from Item

#by, #dead, #id, #time, #type

Instance Method Summary collapse

Methods inherited from Item

from_hash, #initialize

Constructor Details

This class inherits a constructor from Hacker::News::Item

Instance Attribute Details

#kidsObject (readonly)

Returns the value of attribute kids.



76
77
78
# File 'lib/hacker/news/items.rb', line 76

def kids
  @kids
end

#parentObject (readonly)

Returns the value of attribute parent.



76
77
78
# File 'lib/hacker/news/items.rb', line 76

def parent
  @parent
end

#textObject (readonly)

Returns the value of attribute text.



76
77
78
# File 'lib/hacker/news/items.rb', line 76

def text
  @text
end

Instance Method Details

#assign(h) ⇒ Object



78
79
80
81
82
# File 'lib/hacker/news/items.rb', line 78

def assign(h)
  @parent = h['parent']
  @text = h['text']
  @kids = h['kids'] || []
end