Class: Embedit::Flv

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Flv

Returns a new instance of Flv.



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

def initialize(url)
  @url = url
  @format = "video"
  self.html = url
end

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format.



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

def format
  @format
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end

Class Method Details

.match(url) ⇒ Object



25
26
27
# File 'lib/embedit/providers/flv.rb', line 25

def self.match(url)
  url.match(/(.+\.flv$)/)
end

Instance Method Details

#html(options = {}) ⇒ Object



13
14
15
16
17
# File 'lib/embedit/providers/flv.rb', line 13

def html(options = {})
  @html.gsub!(/height="\d+"/, %{height="#{options[:height].to_s}"}) unless options[:height].nil?
  @html.gsub!(/width="\d+"/, %{width="#{options[:width].to_s}"}) unless options[:width].nil?
  @html
end

#html=(url) ⇒ Object



19
20
21
22
23
# File 'lib/embedit/providers/flv.rb', line 19

def html=(url)
  @html = %{<embed src="http://s3.amazonaws.com/panda-test/player.swf" width="400" height="300" 
  allowfullscreen="true" allowscriptaccess="always" 
  flashvars="&displayheight=300&file=#{url}&width=400&height=300" />}
end