octicons_helper 11.0.0.pre.7418f68 → 11.0.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/octicons_helper/helper.rb +13 -3
- data/lib/octicons_helper/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f69573ee37216cd4be748af8d93aa895f72c768e3487d8696eadd26954a354f5
|
4
|
+
data.tar.gz: 3e98c451b042c70fbd602ef530e9b75f38f8c67fad1966e3eb83a6c769a18f7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c170d24dfda3f072287f1ec1518b0ec39bddf3e2d1392ac3ab5c49296f7c3d88fc4c047beae548b462007f2eb9bddb139ace239f938e43302a0abcf21306c3ab
|
7
|
+
data.tar.gz: 7279b247ef23117af757ff00a3c9c48ef81769d971c0b2f839d49ac0e0b24e3c37d1f5fd2c511d0e1338083f06a9f6bb2c3a54953d38418345d71a377f6a67d4
|
@@ -2,13 +2,23 @@ require "octicons"
|
|
2
2
|
require "action_view"
|
3
3
|
|
4
4
|
module OcticonsHelper
|
5
|
-
|
6
5
|
include ActionView::Helpers::TagHelper
|
7
6
|
|
7
|
+
mattr_accessor :octicons_helper_cache, default: {}
|
8
|
+
|
8
9
|
def octicon(symbol, options = {})
|
9
10
|
return "" if symbol.nil?
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
cache_key = [symbol, options].to_s
|
13
|
+
|
14
|
+
if octicons_helper_cache[cache_key]
|
15
|
+
octicons_helper_cache[cache_key]
|
16
|
+
else
|
17
|
+
icon = Octicons::Octicon.new(symbol, options)
|
18
|
+
|
19
|
+
tag = content_tag(:svg, icon.path.html_safe, icon.options).freeze # rubocop:disable Rails/OutputSafety
|
20
|
+
octicons_helper_cache[cache_key] = tag
|
21
|
+
tag
|
22
|
+
end
|
13
23
|
end
|
14
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octicons_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.0.0
|
4
|
+
version: 11.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octicons
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 11.0.0
|
19
|
+
version: 11.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 11.0.0
|
26
|
+
version: 11.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -469,9 +469,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
469
469
|
version: '0'
|
470
470
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
471
471
|
requirements:
|
472
|
-
- - "
|
472
|
+
- - ">="
|
473
473
|
- !ruby/object:Gem::Version
|
474
|
-
version:
|
474
|
+
version: '0'
|
475
475
|
requirements: []
|
476
476
|
rubygems_version: 3.0.1
|
477
477
|
signing_key:
|