Class: Embedit::Swf

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Swf

Returns a new instance of Swf.



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

def initialize(url)
  @url = url
  @format = "rich"
  @title = url.split('/').last
  self.html = url
end

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format.



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

def format
  @format
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end

Class Method Details

.match(url) ⇒ Object



24
25
26
# File 'lib/embedit/providers/swf.rb', line 24

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

Instance Method Details

#html(options = {}) ⇒ Object



14
15
16
17
18
# File 'lib/embedit/providers/swf.rb', line 14

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



20
21
22
# File 'lib/embedit/providers/swf.rb', line 20

def html=(url)
 @html = %{<embed width="400" height="300" quality="high" src="#{url}" type="application/x-shockwave-flash" allowfullscreen="true"/>}
end