gembed 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gembed.rb +11 -1
- data/lib/gembed/loom.rb +2 -2
- data/lib/gembed/youtube.rb +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83230c760b84d9add2b2d68e88b5b674db9181e01ea926f75614cb83c758d23e
|
4
|
+
data.tar.gz: 2466be5e3329960e902c6a7d58bda8335e0760a50c4a72a9bbd4425e98e4e96b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e02fd109beee46f5fcb1ea4fcc4076ea102dd8cba2db2c9934b9ac38b4800df60365b5e9e1de08055aec8683aa954c922891576b26ffcc77376f67950aaed1f3
|
7
|
+
data.tar.gz: 87604ab8c5d44259aad298242a984d4f67aa8d6bb61c782ed89fdda55799b1d0e4c73d1fd11a17695d9663e0463dcb6bff474e9c50f29e18bb81a629b45ef180
|
data/lib/gembed.rb
CHANGED
@@ -6,7 +6,8 @@ module Gembed
|
|
6
6
|
@sources = Hash[
|
7
7
|
"loom.com" => Loom,
|
8
8
|
"youtube.com" => Youtube,
|
9
|
-
"youtu.be" => Youtube
|
9
|
+
"youtu.be" => Youtube,
|
10
|
+
"vimeo.com" => Vimeo
|
10
11
|
]
|
11
12
|
|
12
13
|
class << self
|
@@ -19,6 +20,15 @@ module Gembed
|
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
23
|
+
def get_id(url)
|
24
|
+
source = find_source(url)
|
25
|
+
if @sources[source].nil?
|
26
|
+
return "Source not supported"
|
27
|
+
else
|
28
|
+
@sources[source].find_id(url)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
22
32
|
# Gets domain of the url
|
23
33
|
def find_source(url)
|
24
34
|
@source = url.match(/\/\/[www.]*[a-zA-Z0-9]*\.[a-z]*/).to_s.gsub(/\/\/[www.]*/,'')
|
data/lib/gembed/loom.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Gembed
|
2
2
|
class Loom
|
3
|
-
def self.embed(url)
|
4
|
-
result = "<
|
3
|
+
def self.embed(url, height: "100%", width: "100%")
|
4
|
+
result = "<iframe src='https://www.loom.com/embed/#{find_id(url)}' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen style='position: absolute; top: 0; left: 0; width: #{width}; height: #{height};'></iframe>"
|
5
5
|
result.respond_to?(:html_safe) ? result.html_safe : result
|
6
6
|
end
|
7
7
|
|
data/lib/gembed/youtube.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Gembed
|
2
2
|
class Youtube
|
3
|
-
def self.embed(url)
|
4
|
-
result = "<
|
3
|
+
def self.embed(url, height: "100%", width: "100%")
|
4
|
+
result = "<iframe src='https://www.youtube.com/embed/#{find_id(url)}' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen style='position: absolute; top: 0; left: 0; width: #{width}; height: #{height};'></iframe>"
|
5
5
|
result.respond_to?(:html_safe) ? result.html_safe : result
|
6
6
|
end
|
7
7
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gembed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Paul
|
@@ -10,7 +10,8 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description: Use gembed to embed media in your applications. Give it a url and gembed
|
14
|
+
will embed it for you. As simple as that! For a full list of sources see the wiki.
|
14
15
|
email: hello@johnraj.me
|
15
16
|
executables: []
|
16
17
|
extensions: []
|
@@ -41,5 +42,5 @@ requirements: []
|
|
41
42
|
rubygems_version: 3.1.2
|
42
43
|
signing_key:
|
43
44
|
specification_version: 4
|
44
|
-
summary: A gem for
|
45
|
+
summary: A ruby gem for embedding various media sources by url.
|
45
46
|
test_files: []
|