Module: Twitter::Entities
- Includes:
- Memoizable
- Included in:
- DirectMessage, DirectMessageEvent, DirectMessages::WelcomeMessage, Tweet
- Defined in:
- lib/twitter/entities.rb
Instance Method Summary collapse
- #entities? ⇒ Boolean
- #hashtags ⇒ Array<Twitter::Entity::Hashtag>
- #hashtags? ⇒ Boolean
- #media ⇒ Array<Twitter::Media>
- #media? ⇒ Boolean
- #symbols ⇒ Array<Twitter::Entity::Symbol>
- #symbols? ⇒ Boolean
- #uris ⇒ Array<Twitter::Entity::URI> (also: #urls)
- #uris? ⇒ Boolean (also: #urls?)
- #user_mentions ⇒ Array<Twitter::Entity::UserMention>
- #user_mentions? ⇒ Boolean
Instance Method Details
#entities? ⇒ Boolean
13 14 15 |
# File 'lib/twitter/entities.rb', line 13 def entities? !@attrs[:entities].nil? && @attrs[:entities].any? { |_, array| array.any? } end |
#hashtags ⇒ Array<Twitter::Entity::Hashtag>
Note:
Must include entities in your request for this method to work
20 21 22 |
# File 'lib/twitter/entities.rb', line 20 def entities(Entity::Hashtag, :hashtags) end |
#hashtags? ⇒ Boolean
26 27 28 |
# File 'lib/twitter/entities.rb', line 26 def .any? end |
#media ⇒ Array<Twitter::Media>
Note:
Must include entities in your request for this method to work
33 34 35 36 |
# File 'lib/twitter/entities.rb', line 33 def media extended_entities = entities(MediaFactory, :media, :extended_entities) extended_entities.empty? ? entities(MediaFactory, :media) : extended_entities end |
#media? ⇒ Boolean
40 41 42 |
# File 'lib/twitter/entities.rb', line 40 def media? media.any? end |
#symbols ⇒ Array<Twitter::Entity::Symbol>
Note:
Must include entities in your request for this method to work
47 48 49 |
# File 'lib/twitter/entities.rb', line 47 def symbols entities(Entity::Symbol, :symbols) end |
#symbols? ⇒ Boolean
53 54 55 |
# File 'lib/twitter/entities.rb', line 53 def symbols? symbols.any? end |
#uris ⇒ Array<Twitter::Entity::URI> Also known as: urls
Note:
Must include entities in your request for this method to work
60 61 62 |
# File 'lib/twitter/entities.rb', line 60 def uris entities(Entity::URI, :urls) end |
#uris? ⇒ Boolean Also known as: urls?
67 68 69 |
# File 'lib/twitter/entities.rb', line 67 def uris? uris.any? end |
#user_mentions ⇒ Array<Twitter::Entity::UserMention>
Note:
Must include entities in your request for this method to work
74 75 76 |
# File 'lib/twitter/entities.rb', line 74 def user_mentions entities(Entity::UserMention, :user_mentions) end |
#user_mentions? ⇒ Boolean
80 81 82 |
# File 'lib/twitter/entities.rb', line 80 def user_mentions? user_mentions.any? end |