Class: Video::Vidly

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.match?(uri) ⇒ Boolean

Returns:

  • (Boolean)


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

def self.match?(uri)
  (uri.host =~ /^(?:www\.)?vidly\.com$/i) && (uri.path =~ /^\/[a-z]{4,}/i)
end

Instance Method Details

#assign(uri) ⇒ Object



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

def assign(uri)
  @key = uri.path.match(/^\/([a-z]{4,})/i)[1]
  @url = "http://vidly.com/#{@key}"
end

#embed(style = nil) ⇒ Object



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

def embed(style = nil)
  %(<object width="#{width(style)}" height="#{height(style)}"><param name="movie" value="http://vid.ly/embed/#{@key}"></param><param name="wmode" value="opaque"></param><param name="allowscriptaccess" value="always"></param><param name="allowfullscreen" value="yes"></param><embed src="http://vid.ly/embed/#{@key}" type="application/x-shockwave-flash" wmode="opaque" allowscriptaccess="always" allowfullscreen="yes" width="#{width(style)}" height="#{height(style)}"></embed></object>)
end