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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd6726e520f6f5f2a893e95bf449bef8bdd95f02
4
- data.tar.gz: c70c6ae44e857f5d06ebeecfcee14b641a959069
3
+ metadata.gz: fa191e67f41886a10774b5cf8afe96d36e9df8b2
4
+ data.tar.gz: 663b4c607e06517b9e3f5db6c7b7d9dfe849b0a3
5
5
  SHA512:
6
- metadata.gz: 50dcc95fd77a8fea828c6f28b8850ae8d87d80f0d00a77cfc15f743acf2122b4aa930e5e270596f4986c10fa4af53dff354390597a8f51171de3e7677cf093f2
7
- data.tar.gz: 4906f1e08b0f91904f685512fdb11bb04a3d3b16102da1564b17cfebc95ea0c075f0b244c244242e2811b4bde7f30ac5f8e28312191df20ab6b4c9b4042ebd26
6
+ metadata.gz: 964a746975dc300ef9baf7c45fae3f06761a3b7f6e6c8906f60e4de392eb4a231b94ec644afc2c627d9d79801a05dc773b7ca8018ce626d7e33e7f15d8136df9
7
+ data.tar.gz: 5af0496f0676f485ea0d7c3f186ffe0c96ecc76e2add8a7f491b2030be66a0b4b47d03f620da00b11f2ff8350ebbee17b3d772c54eba7fae1627cb369f9d2d8b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ### 2.8.1 (2015-01-03)
4
+ - Fix: Rails helpers work better out of the box and hit the file system only when necessary.
5
+
3
6
  ### 2.8.1 (2015-12-16)
4
7
  - Fix: Repeat icons no longer retain previous icon's options.
5
8
 
data/lib/esvg.rb CHANGED
@@ -12,9 +12,9 @@ module Esvg
12
12
  extend self
13
13
 
14
14
  def icons(options={})
15
- if @icons.nil?
16
- @icons = SVG.new(options)
17
- elsif !rails? || (rails? && ::Rails.env.downcase != 'production')
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.embed(options).html_safe
3
+ Esvg.icons(options).embed.html_safe
4
4
  end
5
5
 
6
6
  def svg_icon(name, options={})
7
- Esvg.svg_icon(name, options).html_safe
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
@@ -1,3 +1,3 @@
1
1
  module Esvg
2
- VERSION = "2.8.1"
2
+ VERSION = "2.8.2"
3
3
  end
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.1
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: 2015-12-16 00:00:00.000000000 Z
11
+ date: 2016-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler