Class: Video::Vimeo

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.match?(uri) ⇒ Boolean

Returns:

  • (Boolean)


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

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

Instance Method Details

#assign(uri) ⇒ Object



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

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

#embed(style = nil) ⇒ Object



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

def embed(style = nil)
  %(<object width="#{width(style)}" height="#{height(style)}"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=#{@key}&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=#{@key}&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="#{width(style)}" height="#{height(style)}"></embed></object>)
end