Class: Embedit::Player
- Inherits:
-
Object
- Object
- Embedit::Player
- Defined in:
- lib/embedit/player/player.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.
Instance Method Summary collapse
- #html(size = {}) ⇒ Object
- #html=(url) ⇒ Object
-
#initialize(url) ⇒ Player
constructor
A new instance of Player.
Constructor Details
#initialize(url) ⇒ Player
8 9 10 |
# File 'lib/embedit/player/player.rb', line 8 def initialize(url) @url = url end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
6 7 8 |
# File 'lib/embedit/player/player.rb', line 6 def format @format end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
6 7 8 |
# File 'lib/embedit/player/player.rb', line 6 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
6 7 8 |
# File 'lib/embedit/player/player.rb', line 6 def url @url end |
Instance Method Details
#html(size = {}) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/embedit/player/player.rb', line 12 def html(size = {}) self.html = @url # Reset measurements, incase if hmtl is called twice on the same object @html.gsub!(/400/, size[:width].to_s) unless size[:width].nil? @html.gsub!(/300/, size[:height].to_s) unless size[:height].nil? @html end |
#html=(url) ⇒ Object
19 20 21 22 23 |
# File 'lib/embedit/player/player.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 |