class HostedVideo::Providers::Base
Attributes
url[RW]
Public Class Methods
new(url)
click to toggle source
# File lib/hosted_video/providers/base.rb, line 6 def initialize(url) @url = url end
Public Instance Methods
iframe_code(attributes = {})
click to toggle source
# 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
kind()
click to toggle source
# File lib/hosted_video/providers/base.rb, line 10 def kind self.class.name.split('::').last.downcase end
vid()
click to toggle source
# File lib/hosted_video/providers/base.rb, line 14 def vid @vid ||= vid_regex.match(@url)[:id] end
Private Instance Methods
default_iframe_attributes()
click to toggle source
# File lib/hosted_video/providers/base.rb, line 25 def default_iframe_attributes { width: 420, height: 315, frameborder: 0 } end