Class: VideoEmbed
- Inherits:
-
Object
- Object
- VideoEmbed
- Defined in:
- lib/video_embed.rb,
lib/video_embed/vimeo.rb,
lib/video_embed/version.rb,
lib/video_embed/youtube.rb,
lib/video_embed/no_service.rb
Defined Under Namespace
Classes: NoService, Vimeo, YouTube
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Attribute Summary collapse
-
#services ⇒ Object
readonly
Returns the value of attribute services.
Class Method Summary collapse
Instance Method Summary collapse
- #embed(url, options = {}) ⇒ Object
-
#initialize(services = nil) ⇒ VideoEmbed
constructor
A new instance of VideoEmbed.
Constructor Details
#initialize(services = nil) ⇒ VideoEmbed
Returns a new instance of VideoEmbed.
11 12 13 14 15 16 17 |
# File 'lib/video_embed.rb', line 11 def initialize(services = nil) if services.nil? @services = default_services else @services = services end end |
Instance Attribute Details
#services ⇒ Object (readonly)
Returns the value of attribute services.
5 6 7 |
# File 'lib/video_embed.rb', line 5 def services @services end |
Class Method Details
.embed(url, options = {}) ⇒ Object
27 28 29 30 |
# File 'lib/video_embed.rb', line 27 def self.(url, = {}) = new .(url, ) end |
Instance Method Details
#embed(url, options = {}) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/video_embed.rb', line 19 def (url, = {}) if url.is_a? String url = URI.parse(url) end service = find_service_by_url(url) service.(url, ) end |