heroicons_helper 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/heroicons_helper/icon.rb +1 -0
- data/lib/heroicons_helper/version.rb +1 -1
- data/lib/heroicons_helper.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea79c1638e02674896f2f251375b879df8e289d10c39bd1b6550b35f65bb667e
|
4
|
+
data.tar.gz: 49e4f89e38f7ceec4e09970d9864f859424f4e59f314b40353df87e73ff128b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4c7715c0dc796769dd80fd26e38a56bbccadb1c00418ac0ff8911722679bd571e2a2cb058ecbf3931e9c6da3020628239ee5500ef90b05aed66c53f856bec5c
|
7
|
+
data.tar.gz: 0257f55a823a70b7147b4ac0d7c3051fd407febea7577b0ffd2cc9bb2e14b7582299daae2a425f273de59ca7bd4dd5ddd51181baeb5ac40cdd47c1006224a324
|
data/README.md
CHANGED
@@ -22,10 +22,10 @@ require "heroicons_helper"
|
|
22
22
|
include HeroiconsHelper
|
23
23
|
```
|
24
24
|
|
25
|
-
You'll have a brand new method called `
|
25
|
+
You'll have a brand new method called `heroicon` whose signature looks like this:
|
26
26
|
|
27
27
|
```ruby
|
28
|
-
|
28
|
+
heroicon(symbol, variant, attributes: {})
|
29
29
|
```
|
30
30
|
|
31
31
|
where
|
@@ -37,7 +37,7 @@ where
|
|
37
37
|
This one method call returns an object that represents the Heroicon, and you should call `to_svg` to get the resulting SVG string:
|
38
38
|
|
39
39
|
```ruby
|
40
|
-
outline_icon =
|
40
|
+
outline_icon = heroicon("x", "outline")
|
41
41
|
puts outline_icon.to_svg
|
42
42
|
```
|
43
43
|
```
|
@@ -58,7 +58,7 @@ icons_to_preload = [{
|
|
58
58
|
},]
|
59
59
|
|
60
60
|
HeroiconsHelper::Cache.preload!(icons_to_preload) do |found, icon|
|
61
|
-
# An instance of `FakeClass`
|
61
|
+
# An instance of `FakeClass` will be stored in the cache
|
62
62
|
FakeClass.new(icon) unless found
|
63
63
|
end
|
64
64
|
```
|
@@ -57,6 +57,7 @@ module HeroiconsHelper
|
|
57
57
|
def get_heroicon(symbol, variant)
|
58
58
|
symbol_s = symbol.to_s
|
59
59
|
raise ArgumentError, "Icon name can't be empty" if symbol_s.empty?
|
60
|
+
|
60
61
|
variant_s = variant.to_s
|
61
62
|
raise ArgumentError, "Variant `#{variant.inspect}` is invalid; must be one of #{VARIANTS.join(", ")}" unless VARIANTS.include?(variant_s)
|
62
63
|
|
data/lib/heroicons_helper.rb
CHANGED
@@ -9,7 +9,7 @@ module HeroiconsHelper
|
|
9
9
|
file_data = File.read(File.join(File.dirname(__FILE__), "./heroicons_helper/data.json"))
|
10
10
|
ICON_SYMBOLS = JSON.parse(file_data).freeze
|
11
11
|
|
12
|
-
def
|
12
|
+
def heroicon(symbol, variant, attributes: {})
|
13
13
|
::HeroiconsHelper::Icon.new(symbol, variant, attributes: attributes)
|
14
14
|
end
|
15
15
|
end
|