Class: TinyHNews::Story

Inherits:
Object
  • Object
show all
Defined in:
lib/tiny_hnews/story.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, comments_depth: 2, comments_limit: 10) ⇒ Story

Returns a new instance of Story.



5
6
7
8
9
# File 'lib/tiny_hnews/story.rb', line 5

def initialize(id:, comments_depth: 2, comments_limit: 10)
  @id = id
  @comments_depth = comments_depth
  @comments_limit = comments_limit
end

Instance Attribute Details

#articleObject (readonly)

Returns the value of attribute article.



3
4
5
# File 'lib/tiny_hnews/story.rb', line 3

def article
  @article
end

#byObject (readonly)

Returns the value of attribute by.



3
4
5
# File 'lib/tiny_hnews/story.rb', line 3

def by
  @by
end

#commentsObject (readonly)

Returns the value of attribute comments.



3
4
5
# File 'lib/tiny_hnews/story.rb', line 3

def comments
  @comments
end

#descendantsObject (readonly)

Returns the value of attribute descendants.



3
4
5
# File 'lib/tiny_hnews/story.rb', line 3

def descendants
  @descendants
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/tiny_hnews/story.rb', line 3

def id
  @id
end

#kidsObject (readonly)

Returns the value of attribute kids.



3
4
5
# File 'lib/tiny_hnews/story.rb', line 3

def kids
  @kids
end

#scoreObject (readonly)

Returns the value of attribute score.



3
4
5
# File 'lib/tiny_hnews/story.rb', line 3

def score
  @score
end

#textObject (readonly)

Returns the value of attribute text.



3
4
5
# File 'lib/tiny_hnews/story.rb', line 3

def text
  @text
end

#timeObject (readonly)

Returns the value of attribute time.



3
4
5
# File 'lib/tiny_hnews/story.rb', line 3

def time
  @time
end

#titleObject (readonly)

Returns the value of attribute title.



3
4
5
# File 'lib/tiny_hnews/story.rb', line 3

def title
  @title
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/tiny_hnews/story.rb', line 3

def type
  @type
end

#urlObject (readonly)

Returns the value of attribute url.



3
4
5
# File 'lib/tiny_hnews/story.rb', line 3

def url
  @url
end

Instance Method Details

#wrapObject



11
12
13
14
15
16
# File 'lib/tiny_hnews/story.rb', line 11

def wrap
  fetch
  scrap
  load_comments
  self
end