Class: Embedit::Player

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#formatObject (readonly)

Returns the value of attribute format.



6
7
8
# File 'lib/embedit/player/player.rb', line 6

def format
  @format
end

#titleObject (readonly)

Returns the value of attribute title.



6
7
8
# File 'lib/embedit/player/player.rb', line 6

def title
  @title
end

#urlObject (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