Module: X::Resources::References
- Included in:
- Post
- Defined in:
- x-resources/lib/x/resources/references.rb
Overview
Resolves the posts a post refers to through its referenced_posts attribute
Internal to x-resources: the methods it gives a post, such as replied_to, are public API, but the module is only how they are shared, and which classes extend or include it can change within 1.x.
Instance Method Summary collapse
-
#quote? ⇒ Boolean
Check whether this post is a quote.
-
#quoted ⇒ Post?
The post this post quotes.
-
#references ⇒ Array<Post>
The referenced posts, resolved from the includes or built as stubs.
-
#replied_to ⇒ Post?
The post this post replies to.
-
#reply? ⇒ Boolean
Check whether this post is a reply.
-
#repost? ⇒ Boolean
(also: #retweet?)
Check whether this post is a repost.
-
#reposted ⇒ Post?
(also: #retweeted)
The post this post reposts.
Instance Method Details
#quote? ⇒ Boolean
Check whether this post is a quote
88 89 90 |
# File 'x-resources/lib/x/resources/references.rb', line 88 def quote? !quoted.nil? end |
#quoted ⇒ Post?
The post this post quotes
57 58 59 |
# File 'x-resources/lib/x/resources/references.rb', line 57 def quoted reference(QUOTED) end |
#references ⇒ Array<Post>
The referenced posts, resolved from the includes or built as stubs
33 34 35 36 37 |
# File 'x-resources/lib/x/resources/references.rb', line 33 def references referenced_posts.filter_map do |reference| resolve(Post, reference["id"]) #: Post? end.freeze end |
#replied_to ⇒ Post?
The post this post replies to
46 47 48 |
# File 'x-resources/lib/x/resources/references.rb', line 46 def replied_to reference(REPLIED_TO) end |
#reply? ⇒ Boolean
Check whether this post is a reply
78 79 80 |
# File 'x-resources/lib/x/resources/references.rb', line 78 def reply? !replied_to.nil? end |
#repost? ⇒ Boolean Also known as: retweet?
Check whether this post is a repost
98 99 100 |
# File 'x-resources/lib/x/resources/references.rb', line 98 def repost? !reposted.nil? end |
#reposted ⇒ Post? Also known as: retweeted
The post this post reposts
68 69 70 |
# File 'x-resources/lib/x/resources/references.rb', line 68 def reposted reference(REPOSTED, RETWEETED) end |