Class: Yt::Models::Description

Inherits:
String
  • Object
show all
Defined in:
lib/yt/models/description.rb

Overview

Encapsulates information about the description of a resource, for instance a channel. The value has a maximum length of 1000 characters.

Instance Method Summary collapse

Instance Method Details

TODO:

add an option to match the link to a specific channel

Returns whether the description includes a link to a channel.

Examples:

description = Yt::Description.new 'Link to channel: youtube.com/fullscreen'
description.has_link_to_channel? #=> true

Returns:

  • (Boolean)

    whether the description includes a link to a channel



27
28
29
# File 'lib/yt/models/description.rb', line 27

def has_link_to_channel?(options = {})
  links.any?{|link| link.kind == :channel}
end
TODO:

add an option to match the link to a specific playlist

Returns whether the description includes a link to a playlist.

Examples:

description = Yt::Description.new 'Link to playlist: youtube.com/playlist?list=LLxO1tY8h1AhOz0T4ENwmpow'
description.has_link_to_playlist? #=> true

Returns:

  • (Boolean)

    whether the description includes a link to a playlist



47
48
49
# File 'lib/yt/models/description.rb', line 47

def has_link_to_playlist?
  links.any?{|link| link.kind == :playlist}
end
TODO:

add an option to match the link to subscribe to a specific channel

Returns whether the description includes a link to subscribe.

Examples:

description = Yt::Description.new 'Link to subscribe: youtube.com/subscription_center?add_user=fullscreen'
description.has_link_to_subscribe? #=> true

Returns:

  • (Boolean)

    whether the description includes a link to subscribe



37
38
39
# File 'lib/yt/models/description.rb', line 37

def has_link_to_subscribe?(options = {})
  links.any?{|link| link.kind == :subscription}
end
TODO:

add an option to match the link to a specific video

Returns whether the description includes a link to a video.

Examples:

description = Yt::Models::Description.new 'Link to video: youtube.com/watch?v=MESycYJytkU'
description.has_link_to_video? #=> true

Returns:

  • (Boolean)

    whether the description includes a link to a video



17
18
19
# File 'lib/yt/models/description.rb', line 17

def has_link_to_video?
  links.any?{|link| link.kind == :video}
end