Class: MediaEmbedder::Resource::YoutubeShort
- Inherits:
-
Object
- Object
- MediaEmbedder::Resource::YoutubeShort
- Defined in:
- lib/media_embedder/resource/youtube_short.rb
Instance Method Summary collapse
- #can_process_url? ⇒ Boolean
-
#initialize(url) ⇒ YoutubeShort
constructor
A new instance of YoutubeShort.
- #to_html ⇒ Object
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
14 15 16 |
# File 'lib/media_embedder/resource/youtube_short.rb', line 14 def can_process_url? @url.host.include? "youtu.be" end |
#to_html ⇒ Object
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 |