Class: Video::TwitVid

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.match?(uri) ⇒ Boolean

Returns:

  • (Boolean)


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

def self.match?(uri)
  (uri.host =~ /^(?:www\.)?twitvid\.com$/i) && (uri.path =~ /^\/[0-9A-F]{5,}/)
end

Instance Method Details

#assign(uri) ⇒ Object



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

def assign(uri)
  @key = uri.path.match(/^\/([0-9A-F]{5,})/)[1]
  @url = "http://www.twitvid.com/#{@key}"
end

#embed(style = nil) ⇒ Object



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

def embed(style = nil)
  %(<object width="#{width(style)}" height="#{height(style)}"><param name="movie" value="http://www.twitvid.com/player/#{@key}"></param><param name="allowFullScreen" value="true"></param><embed type="application/x-shockwave-flash" src="http://www.twitvid.com/player/#{@key}" quality="high" allowscriptaccess="always" allowNetworking="all" allowfullscreen="true" wmode="transparent" height="#{height(style)}" width="#{width(style)}"></object>)
end