Class: HostedVideo::Providers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/hosted_video/providers/base.rb

Direct Known Subclasses

Rutube, Vimeo, Youtube

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Base

Returns a new instance of Base.



6
7
8
# File 'lib/hosted_video/providers/base.rb', line 6

def initialize(url)
  @url = url
end

Instance Attribute Details

#urlObject

Returns the value of attribute url.



4
5
6
# File 'lib/hosted_video/providers/base.rb', line 4

def url
  @url
end

Instance Method Details

#iframe_code(attributes = {}) ⇒ Object



18
19
20
21
# File 'lib/hosted_video/providers/base.rb', line 18

def iframe_code(attributes = {})
  attrs = default_iframe_attributes.merge(attributes)
  "<iframe #{attrs.map{|key, val| "#{key}='#{val}'"}.join(' ')} src='#{url_for_iframe}'></iframe>"
end

#kindObject



10
11
12
# File 'lib/hosted_video/providers/base.rb', line 10

def kind
  self.class.name.split('::').last.downcase
end

#vidObject



14
15
16
# File 'lib/hosted_video/providers/base.rb', line 14

def vid
  @vid ||= vid_regex.match(@url)[:id]
end