ror_icons 0.1.0 → 0.1.1
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/ror_icons/heroicons.rb +5 -7
- data/lib/ror_icons/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 322c9a8d7e92095a15202b236875b0b5eaa3d259eeb6ed8cbd4aa8f419102db8
|
|
4
|
+
data.tar.gz: 7f0b6b61c78bbb7ff670b43a619b450fbb10fe48e8840929696fa0dc2d195582
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c0374142c5d29bfb9474c855eb7c1d0c4bddc5f5d3cf45ebd8991ea4d92f2eec14f9989b4cd87399c2c8b30cfd1280d92a1202aa4a53a34fbdb63eeb7294d13d
|
|
7
|
+
data.tar.gz: 86e6b8d1d4a166e22933005ca68a4324d7868fa7aa209960143c5f354dcb965616b68b26e8b723fc6c20ebef3ed87330258fd51c2230fc6e9253752170304520
|
data/lib/ror_icons/heroicons.rb
CHANGED
|
@@ -15,16 +15,14 @@ module RorIcons
|
|
|
15
15
|
path = File.join(ICON_ROOT, size.to_s, variant.to_s, "#{icon_name}.svg")
|
|
16
16
|
raise ArgumentError, "Icon not found: #{path}" unless File.exist?(path)
|
|
17
17
|
|
|
18
|
-
svg =
|
|
19
|
-
Rails.cache.fetch(path) { File.read(path) }
|
|
20
|
-
else
|
|
21
|
-
File.read(path)
|
|
22
|
-
end
|
|
18
|
+
svg = (defined?(Rails) && Rails.respond_to?(:cache)) ? Rails.cache.fetch(path) { File.read(path) } : File.read(path)
|
|
23
19
|
doc = Nokogiri::HTML::DocumentFragment.parse(svg)
|
|
24
20
|
svg_node = doc.at_css("svg")
|
|
21
|
+
raise "SVG does not contain <svg> node" unless svg_node
|
|
22
|
+
|
|
23
|
+
svg_node["width"] = size.to_s
|
|
24
|
+
svg_node["height"] = size.to_s
|
|
25
25
|
|
|
26
|
-
svg_node["width"] = size
|
|
27
|
-
svg_node["height"] = size
|
|
28
26
|
svg_node["class"] = css_class if css_class
|
|
29
27
|
attrs.each { |k, v| svg_node[k.to_s] = v }
|
|
30
28
|
|
data/lib/ror_icons/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ror_icons
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Luka Tchelidze
|
|
@@ -38,7 +38,7 @@ dependencies:
|
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '7.1'
|
|
41
|
-
description: Provides
|
|
41
|
+
description: Provides HeroIcons SVG helpers for Rails views, similar to react-icons.
|
|
42
42
|
email:
|
|
43
43
|
- tchelidzeluca@gmail.com
|
|
44
44
|
executables: []
|