heroicons_helper 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/heroicons_helper/icon.rb +7 -5
- data/lib/heroicons_helper/version.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: 1567311352d143cb38d0ebf41388ab02cffa75dde06c9aa02694d06dfde7e3ef
|
4
|
+
data.tar.gz: b865c9123848efdf54afda2336491a15f7289a9e2f91a2a005731436e248c01a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9461351e92db53399116d07f77cbcde4094f50201f550b02d8dcaa125e9671a90b84300c831610be743c6be72d7f578c1069f9ec6e505af484481797225f9c91
|
7
|
+
data.tar.gz: 67d4d42f881e0d435494eaa79890b55022d6187d2f99b26dea652d5a0517203ffcc4f531da01a64ed04b8a15f405f9e080539b25999ca823804b49148c7164aa
|
@@ -55,19 +55,21 @@ module HeroiconsHelper
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def get_heroicon(symbol, variant)
|
58
|
-
|
59
|
-
raise ArgumentError, "
|
58
|
+
symbol_s = symbol.to_s
|
59
|
+
raise ArgumentError, "Icon name can't be empty" if symbol_s.empty?
|
60
|
+
variant_s = variant.to_s
|
61
|
+
raise ArgumentError, "Variant `#{variant.inspect}` is invalid; must be one of #{VARIANTS.join(", ")}" unless VARIANTS.include?(variant_s)
|
60
62
|
|
61
|
-
icon = HeroiconsHelper::ICON_SYMBOLS[
|
63
|
+
icon = HeroiconsHelper::ICON_SYMBOLS[symbol_s]
|
62
64
|
|
63
65
|
raise ArgumentError, "Couldn't find Heroicon for `#{symbol.inspect}`" unless icon
|
64
66
|
|
65
|
-
icon_in_variant = icon["variants"][
|
67
|
+
icon_in_variant = icon["variants"][variant_s]
|
66
68
|
raise ArgumentError, "Heroicon for `#{symbol.inspect}` doesn't have variant `#{variant.inspect}`" unless icon_in_variant
|
67
69
|
|
68
70
|
{
|
69
71
|
"name" => icon["name"],
|
70
|
-
"variant" =>
|
72
|
+
"variant" => variant_s,
|
71
73
|
"width" => icon_in_variant["width"],
|
72
74
|
"height" => icon_in_variant["height"],
|
73
75
|
"path" => icon_in_variant["path"],
|