esvg 2.8.1 → 2.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/esvg.rb +3 -3
- data/lib/esvg/helpers.rb +16 -2
- data/lib/esvg/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa191e67f41886a10774b5cf8afe96d36e9df8b2
|
4
|
+
data.tar.gz: 663b4c607e06517b9e3f5db6c7b7d9dfe849b0a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 964a746975dc300ef9baf7c45fae3f06761a3b7f6e6c8906f60e4de392eb4a231b94ec644afc2c627d9d79801a05dc773b7ca8018ce626d7e33e7f15d8136df9
|
7
|
+
data.tar.gz: 5af0496f0676f485ea0d7c3f186ffe0c96ecc76e2add8a7f491b2030be66a0b4b47d03f620da00b11f2ff8350ebbee17b3d772c54eba7fae1627cb369f9d2d8b
|
data/CHANGELOG.md
CHANGED
data/lib/esvg.rb
CHANGED
@@ -12,9 +12,9 @@ module Esvg
|
|
12
12
|
extend self
|
13
13
|
|
14
14
|
def icons(options={})
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
@icons ||= SVG.new(options)
|
16
|
+
|
17
|
+
if !rails? || Rails.env.development?
|
18
18
|
@icons.read_files
|
19
19
|
end
|
20
20
|
|
data/lib/esvg/helpers.rb
CHANGED
@@ -1,9 +1,23 @@
|
|
1
1
|
module Esvg::Helpers
|
2
2
|
def embed_svgs(options={})
|
3
|
-
Esvg.
|
3
|
+
Esvg.icons(options).embed.html_safe
|
4
4
|
end
|
5
5
|
|
6
6
|
def svg_icon(name, options={})
|
7
|
-
|
7
|
+
name = dasherize(name)
|
8
|
+
|
9
|
+
begin
|
10
|
+
icon_svg = Esvg.icons.svg_icon(name, options).html_safe
|
11
|
+
rescue Exception => e
|
12
|
+
raise e if !Rails.env.production?
|
13
|
+
icon_svg = ''
|
14
|
+
end
|
15
|
+
|
16
|
+
icon_svg
|
8
17
|
end
|
18
|
+
|
19
|
+
def dasherize(input)
|
20
|
+
input.gsub(/[\W,_]/, '-').gsub(/-{2,}/, '-')
|
21
|
+
end
|
22
|
+
|
9
23
|
end
|
data/lib/esvg/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: esvg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|