rubicons 0.10.0 → 0.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 380effeb9f32c02b9441312e03d53ec5900aaa739c56a4258f58acd87bc7aeac
4
- data.tar.gz: db49dadf41d98dcb866bcb84161ed0f089a4978967281c3996ff3857f9acd540
3
+ metadata.gz: '0397031d2f6c8cc5d66e9301f036e1778281109b9a69632d462ce55857c8ff5e'
4
+ data.tar.gz: d6c9b14b23715f34986ce01b364ee7f03dc26db322ab21b7b78ae291dab51bc0
5
5
  SHA512:
6
- metadata.gz: 3ddc8789c29c06c4c2d1fd41ffc6df209aed3c3e1a9b3a5408a21c29ead518e66f2cb09e249d3111e2272ece979cccc17d03a624fbf5f184beb446aba22cc566
7
- data.tar.gz: ed3483118239495e38b646e81fe9d568c8aa7f7ef179815dbf4acae8a436ae82c2ff404dddd18ffde5e345a972cf2b0fdd57d6a6f47c86261e34c0ba23337560
6
+ metadata.gz: 63e55351941a5a37a0dfbac93e8a37eae0394cc32e6799da269fbc731f2409a9121e14376103eb73aa4ac5ffb262868056715ca8d6d2ee521060ae5843da806e
7
+ data.tar.gz: f6bf432b158d1eb9e3081022edc1c75b037ec68c4bbd25ec2ce86f0eba98ba05e9b1828f7851bc34a651e52d82babd263a21769ad79d02a6b7a27f41e3aa2a3b
@@ -25,7 +25,13 @@ module Rubicons
25
25
  # @option options [Hash] :size_map custom size mapping
26
26
  # @return [String] rendered SVG
27
27
  def render_icon(name, icons_path, icon_klass, **options)
28
- render_icon!(name, icons_path, icon_klass, **options)
28
+ if block_given?
29
+ render_icon!(name, icons_path, icon_klass, **options) do |svg_element|
30
+ yield svg_element
31
+ end
32
+ else
33
+ render_icon!(name, icons_path, icon_klass, **options)
34
+ end
29
35
  rescue
30
36
  ''
31
37
  end
@@ -47,6 +53,10 @@ module Rubicons
47
53
  svg_element['stroke'] = icon_klass.stroke_color
48
54
  svg_element['fill'] = icon_klass.fill_color
49
55
 
56
+ if block_given?
57
+ yield svg_element
58
+ end
59
+
50
60
  apply_options_to_svg(svg_element, options)
51
61
 
52
62
  svg_element.to_s
@@ -31,11 +31,11 @@ module Rubicons
31
31
  end
32
32
 
33
33
  def fill_color
34
- 'none'
34
+ 'currentColor'
35
35
  end
36
36
 
37
37
  def stroke_color
38
- 'currentColor'
38
+ 'none'
39
39
  end
40
40
 
41
41
  def available_icons
@@ -35,11 +35,11 @@ module Rubicons
35
35
  end
36
36
 
37
37
  def fill_color
38
- 'none'
38
+ 'currentColor'
39
39
  end
40
40
 
41
41
  def stroke_color
42
- 'currentColor'
42
+ 'none'
43
43
  end
44
44
  end
45
45
  end
@@ -23,11 +23,17 @@ module Rubicons
23
23
  end
24
24
 
25
25
  def icon(name, **options)
26
- BaseIconSet.render_icon(name, ICONS_PATH, self, **options)
26
+ BaseIconSet.render_icon(name, ICONS_PATH, self, **options) do |svg_element|
27
+ svg_element.css('path').each { |path| path['stroke'] = 'currentColor' } if name.to_s.include?('outline')
28
+ svg_element.css('path').each { |path| path['fill'] = 'currentColor' } if name.to_s.include?('solid')
29
+ end
27
30
  end
28
31
 
29
32
  def icon!(name, **options)
30
- BaseIconSet.render_icon!(name, ICONS_PATH, self, **options)
33
+ BaseIconSet.render_icon!(name, ICONS_PATH, self, **options) do |svg_element|
34
+ svg_element.css('path').each { |path| path['stroke'] = 'currentColor' } if name.to_s.include?('outline')
35
+ svg_element.css('path').each { |path| path['fill'] = 'currentColor' } if name.to_s.include?('solid')
36
+ end
31
37
  end
32
38
 
33
39
  def available_icons
@@ -35,7 +41,7 @@ module Rubicons
35
41
  end
36
42
 
37
43
  def fill_color
38
- 'currentColor'
44
+ 'none'
39
45
  end
40
46
 
41
47
  def stroke_color
@@ -23,11 +23,21 @@ module Rubicons
23
23
  end
24
24
 
25
25
  def icon(name, **options)
26
- BaseIconSet.render_icon(name, ICONS_PATH, self, **options)
26
+ BaseIconSet.render_icon(name, ICONS_PATH, self, **options) do |svg_element|
27
+ next unless name.to_s.include?('outline')
28
+
29
+ svg_element['stroke'] = 'currentColor'
30
+ svg_element['fill'] = 'none'
31
+ end
27
32
  end
28
33
 
29
34
  def icon!(name, **options)
30
- BaseIconSet.render_icon!(name, ICONS_PATH, self, **options)
35
+ BaseIconSet.render_icon!(name, ICONS_PATH, self, **options) do |svg_element|
36
+ next unless name.to_s.include?('outline')
37
+
38
+ svg_element['stroke'] = 'currentColor'
39
+ svg_element['stroke'] = 'currentColor'
40
+ end
31
41
  end
32
42
 
33
43
  def available_icons
@@ -23,11 +23,21 @@ module Rubicons
23
23
  end
24
24
 
25
25
  def icon(name, **options)
26
- BaseIconSet.render_icon(name, ICONS_PATH, self, **options)
26
+ BaseIconSet.render_icon(name, ICONS_PATH, self, **options) do |svg_element|
27
+ if name.to_s.include?('filled')
28
+ svg_element['fill'] = 'currentColor'
29
+ svg_element['stroke'] = 'none'
30
+ end
31
+ end
27
32
  end
28
33
 
29
34
  def icon!(name, **options)
30
- BaseIconSet.render_icon!(name, ICONS_PATH, self, **options)
35
+ BaseIconSet.render_icon!(name, ICONS_PATH, self, **options) do |svg_element|
36
+ if name.to_s.include?('filled')
37
+ svg_element['fill'] = 'currentColor'
38
+ svg_element['stroke'] = 'none'
39
+ end
40
+ end
31
41
  end
32
42
 
33
43
  def available_icons
@@ -20,11 +20,15 @@ module Rubicons
20
20
  end
21
21
 
22
22
  def icon(name, **options)
23
- BaseIconSet.render_icon(name, ICONS_PATH, self, **options)
23
+ BaseIconSet.render_icon(name, ICONS_PATH, self, **options) do |svg_element|
24
+ svg_element.css('path').each { |path| path['fill'] = 'currentColor' }
25
+ end
24
26
  end
25
27
 
26
28
  def icon!(name, **options)
27
- BaseIconSet.render_icon!(name, ICONS_PATH, self, **options)
29
+ BaseIconSet.render_icon!(name, ICONS_PATH, self, **options) do |svg_element|
30
+ svg_element.css('path').each { |path| path['fill'] = 'currentColor' }
31
+ end
28
32
  end
29
33
 
30
34
  def available_icons
@@ -32,7 +36,7 @@ module Rubicons
32
36
  end
33
37
 
34
38
  def fill_color
35
- 'currentColor'
39
+ 'none'
36
40
  end
37
41
 
38
42
  def stroke_color
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rubicons
4
- VERSION = '0.10.0'
4
+ VERSION = '0.11.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubicons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - insomnius
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-19 00:00:00.000000000 Z
11
+ date: 2025-07-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rubicons is a pure Ruby icon toolkit inspired by react-icons, offering
14
14
  a simple and consistent way to include SVG-based icons in your Ruby applications