Class: Video::Metacafe

Inherits:
Video
  • Object
show all
Defined in:
lib/videoclip/videos/metacafe.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.match?(uri) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/videoclip/videos/metacafe.rb', line 4

def self.match?(uri)
  (uri.host =~ /^(?:www\.)?metacafe\.com$/i) && (uri.path =~ /^\/watch\/\d+\//)
end

Instance Method Details

#assign(uri) ⇒ Object



8
9
10
11
# File 'lib/videoclip/videos/metacafe.rb', line 8

def assign(uri)
  @key = uri.path.match(/^\/watch\/(\d+)\//)[1]
  @url = "http://www.metacafe.com/videos/#{@key}"
end

#embed(style = nil) ⇒ Object



13
14
15
# File 'lib/videoclip/videos/metacafe.rb', line 13

def embed(style = nil)
  %(<embed src="http://www.metacafe.com/fplayer/#{@key}/video.swf" width="#{width(style)}" height="#{height(style)}" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowFullScreen="true" allowScriptAccess="always" name="Metacafe_#{@key}"></embed>)
end