Class: RedditApi::Comment
- Inherits:
-
Object
- Object
- RedditApi::Comment
- Defined in:
- lib/reddit_api/comment.rb
Instance Attribute Summary collapse
-
#author_name ⇒ Object
readonly
Returns the value of attribute author_name.
-
#reddit_id ⇒ Object
readonly
Returns the value of attribute reddit_id.
-
#subreddit_name ⇒ Object
readonly
Returns the value of attribute subreddit_name.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Comment
constructor
A new instance of Comment.
- #to_h ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Comment
Returns a new instance of Comment.
7 8 9 10 11 |
# File 'lib/reddit_api/comment.rb', line 7 def initialize(args = {}) @reddit_id = args.fetch("id", nil) = args.fetch("author", nil) @subreddit_name = args.fetch("subreddit", nil) end |
Instance Attribute Details
#author_name ⇒ Object (readonly)
Returns the value of attribute author_name.
5 6 7 |
# File 'lib/reddit_api/comment.rb', line 5 def end |
#reddit_id ⇒ Object (readonly)
Returns the value of attribute reddit_id.
5 6 7 |
# File 'lib/reddit_api/comment.rb', line 5 def reddit_id @reddit_id end |
#subreddit_name ⇒ Object (readonly)
Returns the value of attribute subreddit_name.
5 6 7 |
# File 'lib/reddit_api/comment.rb', line 5 def subreddit_name @subreddit_name end |
Instance Method Details
#to_h ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/reddit_api/comment.rb', line 13 def to_h { reddit_id: reddit_id, author_name: , subreddit_name: subreddit_name } end |