Class: Reddit::Post
- Inherits:
-
Object
- Object
- Reddit::Post
- Defined in:
- lib/reddit/post.rb
Constant Summary collapse
- @@post =
[]
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#comments ⇒ Object
Returns the value of attribute comments.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#title ⇒ Object
Returns the value of attribute title.
-
#upvotes ⇒ Object
Returns the value of attribute upvotes.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(title, author, timestamp, comments, upvotes, url) ⇒ Post
constructor
A new instance of Post.
Constructor Details
#initialize(title, author, timestamp, comments, upvotes, url) ⇒ Post
Returns a new instance of Post.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/reddit/post.rb', line 6 def initialize(title, , , comments, upvotes, url) @title = title @author = @timestamp = @comments = comments @upvotes = upvotes @url = url @@post << self end |
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
2 3 4 |
# File 'lib/reddit/post.rb', line 2 def @author end |
#comments ⇒ Object
Returns the value of attribute comments.
2 3 4 |
# File 'lib/reddit/post.rb', line 2 def comments @comments end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
2 3 4 |
# File 'lib/reddit/post.rb', line 2 def @timestamp end |
#title ⇒ Object
Returns the value of attribute title.
2 3 4 |
# File 'lib/reddit/post.rb', line 2 def title @title end |
#upvotes ⇒ Object
Returns the value of attribute upvotes.
2 3 4 |
# File 'lib/reddit/post.rb', line 2 def upvotes @upvotes end |
#url ⇒ Object
Returns the value of attribute url.
2 3 4 |
# File 'lib/reddit/post.rb', line 2 def url @url end |
Class Method Details
.all ⇒ Object
17 18 19 |
# File 'lib/reddit/post.rb', line 17 def self.all @@post end |