Module: Twitter::Entities

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

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) entities?



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

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

- (Array<Twitter::Entity::Hashtag>) hashtags

Note:

Must include entities in your request for this method to work



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

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

- (Boolean) hashtags?



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

def hashtags?
  hashtags.any?
end

- (Array<Twitter::Media>) 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

- (Boolean) media?



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

def media?
  media.any?
end

- (Array<Twitter::Entity::Symbol>) symbols

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

- (Boolean) symbols?



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

def symbols?
  symbols.any?
end

- (Array<Twitter::Entity::URI>) uris 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

- (Boolean) uris? Also known as: urls?



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

def uris?
  uris.any?
end

- (Array<Twitter::Entity::UserMention>) user_mentions

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

- (Boolean) user_mentions?



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

def user_mentions?
  user_mentions.any?
end