Class: MediaEmbedder::Resource::YoutubeShort

Inherits:
Object
  • Object
show all
Defined in:
lib/media_embedder/resource/youtube_short.rb

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ YoutubeShort

Returns a new instance of YoutubeShort.



6
7
8
# File 'lib/media_embedder/resource/youtube_short.rb', line 6

def initialize(url)
  @url = URI.parse url
end

Instance Method Details

#can_process_url?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/media_embedder/resource/youtube_short.rb', line 14

def can_process_url?
  @url.host.include? "youtu.be"
end

#to_htmlObject



10
11
12
# File 'lib/media_embedder/resource/youtube_short.rb', line 10

def to_html
  "<iframe width=\"560\" height=\"315\" src=\"http://www.youtube.com/embed/#{video_id}\" frameborder=\"0\" allowfullscreen></iframe>"
end