heroicons_helper 0.5.0 → 0.7.0

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
  SHA256:
3
- metadata.gz: fa8cbd61b03ddc8aab60aa75caad4b4a0fa7ca42c7b4c808c0900cbcffdbc918
4
- data.tar.gz: 4ddab3edb1ccca807b67c19c4c04dc7c7d58749175a1e8c8ecc6ae50fa410010
3
+ metadata.gz: 5da4c0b0f7f44f07d6503285f56e845985f40dafa7684bc1f9f0dbbaad9a01a4
4
+ data.tar.gz: dc0e4700c426c4d40d0e8006bcd554b448be6ee2fc8a0394bd6258084ef14c93
5
5
  SHA512:
6
- metadata.gz: 16156c67a9b80aef825dde4c4a6f5e331bc0fe23223ba385ecae02867a586ea759eadf8dd2484581b4f51d66aee2489e210de0030b0d88f1bb73d7f3d2ec09d4
7
- data.tar.gz: b222c12def03a08771c1282fff023a707565e93c4695f678af4c8da4aa69b13d3f5d33f1281abfdd6e88b9bfb7754e17fd810c9176ace2d03d392344438e2018
6
+ metadata.gz: 71e76c5abdc3054576e00408126357b6393d7d0eea9f0f447e0cf9f5c404fc6c0b02901669333d2d7dbe5d9aec67ed8e22cfdbfc20817b879a61128e89bdc567
7
+ data.tar.gz: af25792b836859a2f929458552f626e97cf71223b82a8e700659c461e8a1d335360817597af63a5198a21ba1dff7d958f18e729928aab5bbc2e7d9fc67b56396
data/Gemfile CHANGED
@@ -5,6 +5,10 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in heroicons_helper.gemspec
6
6
  gemspec
7
7
 
8
+ group :development do
9
+ gem "bundler", "~> 2.0"
10
+ end
11
+
8
12
  group :development, :test do
9
13
  gem "amazing_print"
10
14
  gem "debug"
data/README.md CHANGED
@@ -31,13 +31,13 @@ heroicon(icon, variant, attributes: {})
31
31
  where
32
32
 
33
33
  * `icon` is the Heroicon name (eg. `:bell` or `"bell")
34
- * `variant` is the type of Heroicons (eg., `outline` or `solid`)
34
+ * `variant` is the type of Heroicons (eg., `outline`, `solid`, or `mini`)
35
35
  * `attributes` are any additional HTML attributes to add on to the resulting `svg` element
36
36
 
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 = heroicon("x", variant: HeroiconsHelper::Icon::VARIANT_OUTLINE)
40
+ outline_icon = heroicon("x-mark", variant: HeroiconsHelper::Icon::VARIANT_OUTLINE)
41
41
  puts outline_icon.to_svg
42
42
  ```
43
43
  ```
@@ -16,6 +16,10 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = spec.homepage
19
+ spec.metadata = {
20
+ "funding_uri" => "https://github.com/sponsors/gjtorikian/",
21
+ "rubygems_mfa_required" => "true",
22
+ }
19
23
 
20
24
  # Specify which files should be added to the gem when it is released.
21
25
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -28,6 +32,8 @@ Gem::Specification.new do |spec|
28
32
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
29
33
  spec.require_paths = ["lib"]
30
34
 
35
+ spec.add_runtime_dependency("activesupport", ">= 6")
36
+
31
37
  # Uncomment to register a new dependency of your gem
32
38
  # spec.add_dependency "example-gem", "~> 1.0"
33
39
 
@@ -6,8 +6,15 @@ module HeroiconsHelper
6
6
  LOOKUP = {}
7
7
 
8
8
  class << self
9
- def get_key(name:, variant:, width: nil, height: nil)
10
- attrs = { name: name, variant: variant, width: width, height: height }
9
+ def get_key(name:, variant:, unsafe: false, width: nil, height: nil)
10
+ attrs = { name: name, variant: variant, unsafe: unsafe, width: width, height: height }
11
+ if unsafe
12
+ attrs[:unsafe] = true
13
+ else
14
+ attrs.delete(:unsafe)
15
+ attrs[:safe] = true
16
+ end
17
+
11
18
  attrs.compact!
12
19
  attrs.hash
13
20
  end
@@ -52,8 +59,9 @@ module HeroiconsHelper
52
59
  cache_key = HeroiconsHelper::Cache.get_key(
53
60
  name: icon["name"],
54
61
  variant: icon["variant"],
62
+ unsafe: icon["unsafe"] || false,
55
63
  height: height,
56
- width: width
64
+ width: width,
57
65
  )
58
66
 
59
67
  cache_icon = HeroiconsHelper::Cache.read(cache_key)