Class: EmbeddedURL::Youtube
- Inherits:
-
Object
- Object
- EmbeddedURL::Youtube
- Defined in:
- lib/embedded_url/youtube.rb
Instance Attribute Summary collapse
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url) ⇒ Youtube
constructor
A new instance of Youtube.
- #to_embedded ⇒ Object
Constructor Details
#initialize(url) ⇒ Youtube
Returns a new instance of Youtube.
6 7 8 |
# File 'lib/embedded_url/youtube.rb', line 6 def initialize(url) self.url = url end |
Instance Attribute Details
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/embedded_url/youtube.rb', line 4 def url @url end |
Instance Method Details
#to_embedded ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/embedded_url/youtube.rb', line 10 def if url =~ /youtube\.com/ video_id = url.split("v=").last "<object width=\"400\" height=\"325\"><param name=\"movie\" value=\"http://www.youtube.com/v/#{video_id}\"></param><param name=\"allowFullScreen\" value=\"true\"></param><embed src=\"http://www.youtube.com/v/#{video_id}\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" width=\"400\" height=\"325\"></embed></object>" end end |