Class: Embedit::GoogleVideo

Inherits:
Object
  • Object
show all
Defined in:
lib/embedit/providers/google_video.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ GoogleVideo

Returns a new instance of GoogleVideo.



7
8
9
10
# File 'lib/embedit/providers/google_video.rb', line 7

def initialize(url)
  @url = url
  @format = "video"
end

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format.



5
6
7
# File 'lib/embedit/providers/google_video.rb', line 5

def format
  @format
end

#titleObject (readonly)

Returns the value of attribute title.



5
6
7
# File 'lib/embedit/providers/google_video.rb', line 5

def title
  @title
end

#urlObject (readonly)

Returns the value of attribute url.



5
6
7
# File 'lib/embedit/providers/google_video.rb', line 5

def url
  @url
end

Class Method Details

.match(url) ⇒ Object



27
28
29
# File 'lib/embedit/providers/google_video.rb', line 27

def self.match(url)
  url.match(/video\.google\.com\/videoplay\?docid=-(\w+)/)
end

Instance Method Details

#doc_idObject



17
18
19
# File 'lib/embedit/providers/google_video.rb', line 17

def doc_id
  @url[/video\.google\.com\/videoplay\?docid=-(\w+)/,1]
end

#html(options = {}) ⇒ Object



12
13
14
15
# File 'lib/embedit/providers/google_video.rb', line 12

def html(options={})
  options.reverse_merge!(:width=>400, :height=>326)
  %{<embed id="VideoPlayback" src="http://video.google.com/googleplayer.swf?docid=-#{doc_id}&hl=en&fs=true" style="width:#{options[:width]}px;height:#{options[:height]}px" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash"> </embed>}
end