Class: Video::FunnyOrDie

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.match?(uri) ⇒ Boolean

Returns:

  • (Boolean)


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

def self.match?(uri)
  (uri.host =~ /^(?:www\.)?funnyordie\.com$/i) && (uri.path =~ /^\/videos\/[0-9a-f]{10}\//)
end

Instance Method Details

#assign(uri) ⇒ Object



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

def assign(uri)
  @key = uri.path.match(/^\/videos\/([0-9a-f]{10})\//)[1]
  @url = "http://www.funnyordie.com/videos/#{@key}"
end

#embed(style = nil) ⇒ Object



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

def embed(style = nil)
  %(<object width="#{width(style)}" height="#{height(style)}" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="ordie_player_#{@key}"><param name="movie" value="http://player.ordienetworks.com/flash/fodplayer.swf" /><param name="flashvars" value="key=#{@key}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always"></param><embed width="#{width(style)}" height="#{height(style)}" flashvars="key=#{@key}" allowfullscreen="true" allowscriptaccess="always" quality="high" src="http://player.ordienetworks.com/flash/fodplayer.swf" name="ordie_player_#{@key}" type="application/x-shockwave-flash"></embed></object>)
end