Class: Video::CollegeHumor

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.match?(uri) ⇒ Boolean

Returns:

  • (Boolean)


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

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

Instance Method Details

#assign(uri) ⇒ Object



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

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

#embed(style = nil) ⇒ Object



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

def embed(style = nil)
  %(<object type="application/x-shockwave-flash" data="http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=#{@key}&fullscreen=1" width="#{width(style)}" height="#{height(style)}" ><param name="allowfullscreen" value="true"/><param name="wmode" value="transparent"/><param name="allowScriptAccess" value="always"/><param name="movie" quality="best" value="http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=#{@key}&fullscreen=1"/><embed src="http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=#{@key}&fullscreen=1" type="application/x-shockwave-flash" wmode="transparent"  width="#{width(style)}" height="#{height(style)}" allowScriptAccess="always"></embed></object>)
end