Class: HNPosts::Post
- Inherits:
-
Object
- Object
- HNPosts::Post
- Defined in:
- lib/hnposts/post.rb
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
Returns the value of attribute comments.
-
#points ⇒ Object
readonly
Returns the value of attribute points.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#post_id ⇒ Object
readonly
Returns the value of attribute post_id.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(options) ⇒ Post
constructor
A new instance of Post.
- #to_s ⇒ Object
Constructor Details
#initialize(options) ⇒ Post
Returns a new instance of Post.
7 8 9 10 11 12 13 14 |
# File 'lib/hnposts/post.rb', line 7 def initialize( ) @post_id = [:post_id] @title = [:title] @url = [:url] @points = [:points] @comments = [:comments] @position = [:position] end |
Instance Attribute Details
#comments ⇒ Object (readonly)
Returns the value of attribute comments.
5 6 7 |
# File 'lib/hnposts/post.rb', line 5 def comments @comments end |
#points ⇒ Object (readonly)
Returns the value of attribute points.
5 6 7 |
# File 'lib/hnposts/post.rb', line 5 def points @points end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
5 6 7 |
# File 'lib/hnposts/post.rb', line 5 def position @position end |
#post_id ⇒ Object (readonly)
Returns the value of attribute post_id.
5 6 7 |
# File 'lib/hnposts/post.rb', line 5 def post_id @post_id end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/hnposts/post.rb', line 5 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'lib/hnposts/post.rb', line 5 def url @url end |
Instance Method Details
#to_s ⇒ Object
16 17 18 |
# File 'lib/hnposts/post.rb', line 16 def to_s "#{post_id} - position #{position}, #{title}, #{points} points #{comments} comments, #{url}" end |