Class: HackernewsApi::Comment
- Inherits:
-
Object
- Object
- HackernewsApi::Comment
- Defined in:
- lib/hackernews_api/comment.rb
Instance Attribute Summary collapse
-
#by ⇒ Object
readonly
Returns the value of attribute by.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#kids ⇒ Object
readonly
Returns the value of attribute kids.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(json) ⇒ Comment
constructor
A new instance of Comment.
Constructor Details
#initialize(json) ⇒ Comment
Returns a new instance of Comment.
10 11 12 13 14 15 16 17 18 |
# File 'lib/hackernews_api/comment.rb', line 10 def initialize json @id = json['id'] @by = json['by'] @kids = json['kids'] @time = DateTime.strptime(json['time'].to_s, '%s') @type = json['type'] @parent = json['parent'] @text = json['text'] end |
Instance Attribute Details
#by ⇒ Object (readonly)
Returns the value of attribute by.
8 9 10 |
# File 'lib/hackernews_api/comment.rb', line 8 def by @by end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/hackernews_api/comment.rb', line 8 def id @id end |
#kids ⇒ Object (readonly)
Returns the value of attribute kids.
8 9 10 |
# File 'lib/hackernews_api/comment.rb', line 8 def kids @kids end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
8 9 10 |
# File 'lib/hackernews_api/comment.rb', line 8 def parent @parent end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
8 9 10 |
# File 'lib/hackernews_api/comment.rb', line 8 def text @text end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
8 9 10 |
# File 'lib/hackernews_api/comment.rb', line 8 def time @time end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/hackernews_api/comment.rb', line 8 def type @type end |