Module: Twitter::Entities

Includes:
Memoizable
Included in:
DirectMessage, DirectMessageEvent, DirectMessages::WelcomeMessage, Tweet
Defined in:
lib/twitter/entities.rb

Instance Method Summary collapse

Instance Method Details

#entities?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/twitter/entities.rb', line 13

def entities?
  !@attrs[:entities].nil? && @attrs[:entities].any? { |_, array| array.any? }
end

#hashtagsArray<Twitter::Entity::Hashtag>

Note:

Must include entities in your request for this method to work

Returns:



20
21
22
# File 'lib/twitter/entities.rb', line 20

def hashtags
  entities(Entity::Hashtag, :hashtags)
end

#hashtags?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/twitter/entities.rb', line 26

def hashtags?
  hashtags.any?
end

#mediaArray<Twitter::Media>

Note:

Must include entities in your request for this method to work

Returns:



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

Returns:

  • (Boolean)


40
41
42
# File 'lib/twitter/entities.rb', line 40

def media?
  media.any?
end

#symbolsArray<Twitter::Entity::Symbol>

Note:

Must include entities in your request for this method to work

Returns:



47
48
49
# File 'lib/twitter/entities.rb', line 47

def symbols
  entities(Entity::Symbol, :symbols)
end

#symbols?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/twitter/entities.rb', line 53

def symbols?
  symbols.any?
end

#urisArray<Twitter::Entity::URI> Also known as: urls

Note:

Must include entities in your request for this method to work

Returns:



60
61
62
# File 'lib/twitter/entities.rb', line 60

def uris
  entities(Entity::URI, :urls)
end

#uris?Boolean Also known as: urls?

Returns:

  • (Boolean)


67
68
69
# File 'lib/twitter/entities.rb', line 67

def uris?
  uris.any?
end

#user_mentionsArray<Twitter::Entity::UserMention>

Note:

Must include entities in your request for this method to work

Returns:



74
75
76
# File 'lib/twitter/entities.rb', line 74

def user_mentions
  entities(Entity::UserMention, :user_mentions)
end

#user_mentions?Boolean

Returns:

  • (Boolean)


80
81
82
# File 'lib/twitter/entities.rb', line 80

def user_mentions?
  user_mentions.any?
end