Class: Embedit::Swf
- Inherits:
-
Object
- Object
- Embedit::Swf
- Defined in:
- lib/embedit/providers/swf.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #html(options = {}) ⇒ Object
- #html=(url) ⇒ Object
-
#initialize(url) ⇒ Swf
constructor
A new instance of Swf.
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
#format ⇒ Object (readonly)
Returns the value of attribute format.
5 6 7 |
# File 'lib/embedit/providers/swf.rb', line 5 def format @format end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/embedit/providers/swf.rb', line 5 def title @title end |
#url ⇒ Object (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( = {}) @html.gsub!(/height="\d+"/, %{height="#{[:height].to_s}"}) unless [:height].nil? @html.gsub!(/width="\d+"/, %{width="#{[:width].to_s}"}) unless [: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 |