rubicons 0.4.0 → 0.5.1

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: cb94b38071f401ab61b73bb5a9b92a79a3d728d1b22e59a711fa0b550a027e44
4
- data.tar.gz: 5e78514ed0ef925f7619ef4817666400b5096957b358900876677bacd608c975
3
+ metadata.gz: db5716581c89fd9abd2170b851bba28dc7ad15c5b16196d963f87aaeb6bf5fcf
4
+ data.tar.gz: b37653468dbe10897f565dfd0b186cd5e183192e6e59d0629e760bdfc8bb99a5
5
5
  SHA512:
6
- metadata.gz: 8f64c7a980cd07a077a6920e458bd3f189cab011d287502208db0b3b8aae160453a7f313b9af5f5210b2a5882d3412019789b1a7bc5a5a27335f56028658884b
7
- data.tar.gz: 0c32b8d6954e27f57366f4ddc229ecc9b7157c2b3385794dfd72c1b2f0f62e42b14234370d4b41e74e9fc8707750686e532c2345f892a63336c5d1d69960e9a0
6
+ metadata.gz: 1d7c5549dc66301a2329cda9eed2449de3675cf61cad3bf70e0886c160bddc850ade4d2ffb6b2629e214597fc9cb457c98d78c3cf13d8ec6dcf330d88dd65b86
7
+ data.tar.gz: cb51368557c5c4eaf3c76310517ad70c2ea66d69dfc14faaa001c23a18e63b28e1cbc4ccb89c0b1592aa439760f73687b2c22960e2ad2b3b1968725a23f9ec80
data/README.md CHANGED
@@ -34,12 +34,10 @@ $ gem install rubicons
34
34
 
35
35
  ## Icon Collections
36
36
 
37
- Rubicons provides access to **20** popular icon libraries with thousands of icons:
37
+ Rubicons provides access to **22** popular icon libraries with thousands of icons:
38
38
 
39
39
  | Icon Library | Version | License | Count | Example Icons |
40
40
  | --- | --- | --- | ---: | --- |
41
- | [Lucide](https://lucide.dev/) | Latest | [ISC](https://github.com/lucide-icons/lucide/blob/main/LICENSE) | 1,565 | `heart`, `activity`, `book`, `check`, `user` |
42
- | [Radix UI](https://www.radix-ui.com/icons) | Latest | [MIT](https://github.com/radix-ui/icons/blob/master/LICENSE) | 318 | `accessibility`, `activity-log`, `align-bottom`, `align-center-horizontally`, `bookmark` |
43
41
  | [Bootstrap](https://icons.getbootstrap.com/) | v1.11.3 | [MIT](https://github.com/twbs/icons/blob/main/LICENSE) | 2,050 | `alarm`, `heart`, `calendar`, `circle`, `house` |
44
42
  | [Box Icons](https://boxicons.com/) | Latest | [MIT/CC 4.0](https://github.com/atisawd/boxicons/blob/master/LICENSE) | 1,634 | `bx-home`, `bx-search`, `bx-menu`, `bx-user`, `bxl-github` |
45
43
  | [Circum Icons](https://circumicons.com/) | Latest | [MPL-2.0](https://github.com/Klarr-Agency/Circum-Icons/blob/main/LICENSE) | 288 | `alarm-on`, `align-center-h`, `arrow`, `check`, `user` |
@@ -51,9 +49,11 @@ Rubicons provides access to **20** popular icon libraries with thousands of icon
51
49
  | [Ionicons 4](https://ionic.io/ionicons/v4) | v4.6.4-1 | [MIT](https://github.com/ionic-team/ionicons/blob/main/LICENSE) | 696 | `ios-add`, `ios-alarm`, `ios-home`, `md-mail`, `md-menu` |
52
50
  | [Ionicons 5](https://ionic.io/ionicons) | v5.5.4 | [MIT](https://github.com/ionic-team/ionicons/blob/main/LICENSE) | 1,332 | `accessibility`, `add-circle`, `home`, `mail`, `menu` |
53
51
  | [Line Awesome](https://icons8.com/line-awesome) | Latest | [MIT/Good Boy](https://github.com/icons8/line-awesome/blob/master/LICENSE.md) | 1,544 | `500px`, `accessible-icon`, `github`, `user-solid`, `heart` |
52
+ | [Lucide](https://lucide.dev/) | Latest | [ISC](https://github.com/lucide-icons/lucide/blob/main/LICENSE) | 1,565 | `heart`, `activity`, `book`, `check`, `user` |
54
53
  | [Material Design](https://materialdesignicons.com/) | v4.0.0 | [Apache 2.0](https://github.com/google/material-design-icons/blob/master/LICENSE) | 6862 | `action-3d-rotation`, `action-accessibility`, `action-account-circle`, `content-home`, `action-settings` |
55
54
  | [Octicons](https://primer.github.io/octicons/) | v18.3.0 | [MIT](https://github.com/primer/octicons/blob/main/LICENSE) | 576 | `accessibility-16`, `alert-16`, `check-16`, `code-16`, `mark-github-16` |
56
55
  | [Phosphor Icons](https://phosphoricons.com/) | Latest | [MIT](https://github.com/phosphor-icons/core/blob/main/LICENSE) | 9,072 | `acorn-bold`, `user-bold`, `heart-fill`, `house-line`, `calendar` |
56
+ | [Radix UI](https://www.radix-ui.com/icons) | Latest | [MIT](https://github.com/radix-ui/icons/blob/master/LICENSE) | 318 | `accessibility`, `activity-log`, `align-bottom`, `align-center-horizontally`, `bookmark` |
57
57
  | [Remix Icon](https://remixicon.com/) | v4.2.0 | [Apache 2.0](https://github.com/Remix-Design/RemixIcon/blob/master/License) | 2,860 | `arrow-down-circle-fill`, `home-line`, `user-fill`, `search-line`, `check-line` |
58
58
  | [Tabler Icons](https://tabler-icons.io/) | v3.31.0 | [MIT](https://github.com/tabler/tabler-icons/blob/master/LICENSE) | 5,880 | `filled-accessible`, `filled-home`, `filled-user`, `filled-search`, `brand-github` |
59
59
  | [Themify](https://themify.me/themify-icons) | v1.0.1 | [SIL OFL/MIT](https://github.com/lykmapipo/themify-icons/blob/master/README.md#license) | 352 | `angle-down`, `agenda`, `alarm-clock`, `alert`, `align-center` |
@@ -4,9 +4,9 @@ require 'nokogiri'
4
4
 
5
5
  module Rubicons
6
6
  # Base module for icon sets with common functionality
7
- module BaseIconSet
7
+ class BaseIconSet
8
8
  # Default size mapping that can be overridden by specific icon sets
9
- DEFAULT_SIZE_MAP = {
9
+ SIZE_MAP = {
10
10
  xs: '12',
11
11
  sm: '16',
12
12
  md: '20',
@@ -15,63 +15,65 @@ module Rubicons
15
15
  "2xl": '40'
16
16
  }.freeze
17
17
 
18
- # Helper method to render an SVG icon with customizations
19
- # @param name [String, Symbol] icon name
20
- # @param icons_path [String] path to icons directory
21
- # @param options [Hash] options for customizing the icon
22
- # @option options [Symbol, String] :size (:md) size of the icon
23
- # @option options [String] :class CSS classes to add
24
- # @option options [Hash] :size_map custom size mapping
25
- # @return [String] rendered SVG
26
- def render_icon(name, icons_path, **options)
27
- render_icon!(name, icons_path, **options)
28
- rescue
29
- ''
30
- end
18
+ class << self
19
+ # Helper method to render an SVG icon with customizations
20
+ # @param name [String, Symbol] icon name
21
+ # @param icons_path [String] path to icons directory
22
+ # @param options [Hash] options for customizing the icon
23
+ # @option options [Symbol, String] :size (:md) size of the icon
24
+ # @option options [String] :class CSS classes to add
25
+ # @option options [Hash] :size_map custom size mapping
26
+ # @return [String] rendered SVG
27
+ def render_icon(name, icons_path, **options)
28
+ render_icon!(name, icons_path, **options)
29
+ rescue
30
+ ''
31
+ end
31
32
 
32
- def render_icon!(name, icons_path, **options)
33
- icon_path = File.join(icons_path, "#{name}.svg")
34
- raise ArgumentError, "Icon '#{name}' not found" unless File.exist?(icon_path)
33
+ def render_icon!(name, icons_path, **options)
34
+ icon_path = File.join(icons_path, "#{name}.svg")
35
+ raise ArgumentError, "Icon '#{name}' not found" unless File.exist?(icon_path)
35
36
 
36
- svg = File.read(icon_path)
37
- doc = Nokogiri::HTML::DocumentFragment.parse(svg)
38
- svg_element = doc.at_css 'svg'
37
+ svg = File.read(icon_path)
38
+ doc = Nokogiri::HTML::DocumentFragment.parse(svg)
39
+ svg_element = doc.at_css 'svg'
39
40
 
40
- size_map = options.delete(:size_map) || self::SIZE_MAP
41
- size_key = (options.delete(:size) || :md).to_sym
42
- svg_size = size_map[size_key] || size_map[:md]
41
+ size_map = options.delete(:size_map) || self::SIZE_MAP
42
+ size_key = (options.delete(:size) || :md).to_sym
43
+ svg_size = size_map[size_key] || size_map[:md]
43
44
 
44
- svg_element['width'] = svg_size
45
- svg_element['height'] = svg_size
45
+ svg_element['width'] = svg_size
46
+ svg_element['height'] = svg_size
46
47
 
47
- apply_options_to_svg(svg_element, options)
48
+ apply_options_to_svg(svg_element, options)
48
49
 
49
- svg_element.to_s
50
- end
50
+ svg_element.to_s
51
+ end
51
52
 
52
- # Helper method to apply options to an SVG element
53
- # @param svg_element [Nokogiri::XML::Element] SVG element to modify
54
- # @param options [Hash] options to apply
55
- # @return [Nokogiri::XML::Element] modified SVG element
56
- def apply_options_to_svg(svg_element, options)
57
- svg_element['class'] = options.delete(:class) if options[:class]
58
- svg_element['stroke'] = options.delete(:stroke) if options[:stroke]
59
- svg_element['fill'] = options.delete(:fill) if options[:fill]
60
- svg_element['stroke-width'] = options.delete(:stroke_width).to_s if options[:stroke_width]
53
+ # Helper method to apply options to an SVG element
54
+ # @param svg_element [Nokogiri::XML::Element] SVG element to modify
55
+ # @param options [Hash] options to apply
56
+ # @return [Nokogiri::XML::Element] modified SVG element
57
+ def apply_options_to_svg(svg_element, options)
58
+ svg_element['class'] = options.delete(:class) if options[:class]
59
+ svg_element['stroke'] = options.delete(:stroke) if options[:stroke]
60
+ svg_element['fill'] = options.delete(:fill) if options[:fill]
61
+ svg_element['stroke-width'] = options.delete(:stroke_width).to_s if options[:stroke_width]
61
62
 
62
- # Add any remaining attributes from options
63
- options.each do |key, value|
64
- svg_element[key.to_s.tr('_', '-')] = value.to_s
65
- end
63
+ # Add any remaining attributes from options
64
+ options.each do |key, value|
65
+ svg_element[key.to_s.tr('_', '-')] = value.to_s
66
+ end
66
67
 
67
- svg_element
68
- end
68
+ svg_element
69
+ end
69
70
 
70
- # Helper method to load all available icon names
71
- # @param icons_path [String] path to icons directory
72
- # @return [Array<Symbol>] list of available icon names
73
- def available_icons(icons_path)
74
- Dir.glob("#{icons_path}/*.svg").map { |path| File.basename(path, '.svg').to_sym }
71
+ # Helper method to load all available icon names
72
+ # @param icons_path [String] path to icons directory
73
+ # @return [Array<Symbol>] list of available icon names
74
+ def available_icons(icons_path)
75
+ Dir.glob("#{icons_path}/*.svg").map { |path| File.basename(path, '.svg').to_sym }
76
+ end
75
77
  end
76
78
  end
77
79
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module Bootstrap
8
8
  autoload :RailsHelper, 'rubicons/bootstrap/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/bootstrap', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module BoxIcons
8
8
  autoload :RailsHelper, 'rubicons/box_icons/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/box_icons', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module CircumIcons
8
8
  autoload :RailsHelper, 'rubicons/circum_icons/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/circum_icons', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module Feather
8
8
  autoload :RailsHelper, 'rubicons/feather/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/feather', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module FontAwesome5
8
8
  autoload :RailsHelper, 'rubicons/font_awesome5/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/font_awesome5', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module FontAwesome6
8
8
  autoload :RailsHelper, 'rubicons/font_awesome6/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/font_awesome6', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module Heroicons
8
8
  autoload :RailsHelper, 'rubicons/heroicons/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/heroicons', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module Heroicons2
8
8
  autoload :RailsHelper, 'rubicons/heroicons2/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/heroicons2', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module Ionicons4
8
8
  autoload :RailsHelper, 'rubicons/ionicons4/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/ionicons4', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module Ionicons5
8
8
  autoload :RailsHelper, 'rubicons/ionicons5/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/ionicons5', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module LineAwesome
8
8
  autoload :RailsHelper, 'rubicons/line_awesome/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/line_awesome', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
@@ -6,22 +6,19 @@ module Rubicons
6
6
  module Lucide
7
7
  autoload :RailsHelper, 'rubicons/lucide/rails_helper'
8
8
 
9
- extend BaseIconSet
10
-
11
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
12
9
  ICONS_PATH = File.expand_path('../../icons/lucide', __dir__)
13
10
 
14
11
  class << self
15
12
  def icon(name, **options)
16
- render_icon(name, ICONS_PATH, **options)
13
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
17
14
  end
18
15
 
19
16
  def icon!(name, **options)
20
- render_icon!(name, ICONS_PATH, **options)
17
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
21
18
  end
22
19
 
23
20
  def available_icons
24
- available_icons(ICONS_PATH)
21
+ BaseIconSet.available_icons(ICONS_PATH)
25
22
  end
26
23
  end
27
24
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module MaterialDesign
8
8
  autoload :RailsHelper, 'rubicons/material_design/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/material_design', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module Octicons
8
8
  autoload :RailsHelper, 'rubicons/octicons/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/octicons', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module PhosphorIcons
8
8
  autoload :RailsHelper, 'rubicons/phosphor_icons/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/phosphor_icons', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
@@ -6,22 +6,19 @@ module Rubicons
6
6
  module Radix
7
7
  autoload :RailsHelper, 'rubicons/radix/rails_helper'
8
8
 
9
- extend BaseIconSet
10
-
11
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
12
9
  ICONS_PATH = File.expand_path('../../icons/radix', __dir__)
13
10
 
14
11
  class << self
15
12
  def icon(name, **options)
16
- render_icon(name, ICONS_PATH, **options)
13
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
17
14
  end
18
15
 
19
16
  def icon!(name, **options)
20
- render_icon!(name, ICONS_PATH, **options)
17
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
21
18
  end
22
19
 
23
20
  def available_icons
24
- available_icons(ICONS_PATH)
21
+ BaseIconSet.available_icons(ICONS_PATH)
25
22
  end
26
23
  end
27
24
  end
@@ -1,74 +1,56 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rails'
4
- require 'rubicons/lucide'
5
- require 'rubicons/radix'
4
+ require 'rubicons/bootstrap'
5
+ require 'rubicons/box_icons'
6
6
  require 'rubicons/circum_icons'
7
+ require 'rubicons/feather'
7
8
  require 'rubicons/font_awesome5'
8
9
  require 'rubicons/font_awesome6'
10
+ require 'rubicons/heroicons'
11
+ require 'rubicons/heroicons2'
9
12
  require 'rubicons/ionicons4'
10
13
  require 'rubicons/ionicons5'
14
+ require 'rubicons/line_awesome'
15
+ require 'rubicons/lucide'
11
16
  require 'rubicons/material_design'
12
- require 'rubicons/typicons'
13
17
  require 'rubicons/octicons'
14
- require 'rubicons/feather'
15
- require 'rubicons/game_icons'
16
- require 'rubicons/weather_icons'
17
- require 'rubicons/devicons'
18
- require 'rubicons/ant_design'
19
- require 'rubicons/bootstrap'
18
+ require 'rubicons/phosphor_icons'
19
+ require 'rubicons/radix'
20
20
  require 'rubicons/remix_icon'
21
- require 'rubicons/flat_color_icons'
22
- require 'rubicons/grommet_icons'
23
- require 'rubicons/heroicons'
24
- require 'rubicons/heroicons2'
25
21
  require 'rubicons/simple_icons'
26
- require 'rubicons/simple_line_icons'
27
- require 'rubicons/ico_moon'
28
- require 'rubicons/box_icons'
29
- require 'rubicons/css_gg'
30
- require 'rubicons/vs_code_icons'
31
22
  require 'rubicons/tabler_icons'
32
23
  require 'rubicons/themify_icons'
33
- require 'rubicons/phosphor_icons'
34
- require 'rubicons/line_awesome'
24
+ require 'rubicons/typicons'
25
+ require 'rubicons/weather_icons'
35
26
 
36
27
  module Rubicons
37
28
  # Railtie to integrate Rubicons with Rails
38
29
  class Railtie < Rails::Railtie
39
30
  initializer 'rubicons.helpers' do
40
31
  ActiveSupport.on_load(:action_view) do
41
- include Rubicons::Lucide::RailsHelper
42
- include Rubicons::Radix::RailsHelper
32
+ include Rubicons::Bootstrap::RailsHelper
33
+ include Rubicons::BoxIcons::RailsHelper
43
34
  include Rubicons::CircumIcons::RailsHelper
35
+ include Rubicons::Feather::RailsHelper
44
36
  include Rubicons::FontAwesome5::RailsHelper
45
37
  include Rubicons::FontAwesome6::RailsHelper
38
+ include Rubicons::Heroicons::RailsHelper
39
+ include Rubicons::Heroicons2::RailsHelper
46
40
  include Rubicons::Ionicons4::RailsHelper
47
41
  include Rubicons::Ionicons5::RailsHelper
42
+ include Rubicons::LineAwesome::RailsHelper
43
+ include Rubicons::Lucide::RailsHelper
48
44
  include Rubicons::MaterialDesign::RailsHelper
49
- include Rubicons::Typicons::RailsHelper
50
45
  include Rubicons::Octicons::RailsHelper
51
- include Rubicons::Feather::RailsHelper
52
- include Rubicons::GameIcons::RailsHelper if defined?(Rubicons::GameIcons)
53
- include Rubicons::WeatherIcons::RailsHelper
54
- include Rubicons::Devicons::RailsHelper if defined?(Rubicons::Devicons)
55
- include Rubicons::AntDesign::RailsHelper if defined?(Rubicons::AntDesign)
56
- include Rubicons::Bootstrap::RailsHelper
46
+ include Rubicons::PhosphorIcons::RailsHelper
47
+ include Rubicons::Radix::RailsHelper
57
48
  include Rubicons::RemixIcon::RailsHelper
58
- include Rubicons::FlatColorIcons::RailsHelper if defined?(Rubicons::FlatColorIcons)
59
- include Rubicons::GrommetIcons::RailsHelper if defined?(Rubicons::GrommetIcons)
60
- include Rubicons::Heroicons::RailsHelper
61
- include Rubicons::Heroicons2::RailsHelper
62
49
  include Rubicons::SimpleIcons::RailsHelper
63
- include Rubicons::SimpleLineIcons::RailsHelper if defined?(Rubicons::SimpleLineIcons)
64
- include Rubicons::IcoMoon::RailsHelper if defined?(Rubicons::IcoMoon)
65
- include Rubicons::BoxIcons::RailsHelper
66
- include Rubicons::CssGg::RailsHelper if defined?(Rubicons::CssGg)
67
- include Rubicons::VsCodeIcons::RailsHelper if defined?(Rubicons::VsCodeIcons)
68
50
  include Rubicons::TablerIcons::RailsHelper
69
- include Rubicons::ThemifyIcons::RailsHelper if defined?(Rubicons::ThemifyIcons)
70
- include Rubicons::PhosphorIcons::RailsHelper
71
- include Rubicons::LineAwesome::RailsHelper
51
+ include Rubicons::ThemifyIcons::RailsHelper
52
+ include Rubicons::Typicons::RailsHelper
53
+ include Rubicons::WeatherIcons::RailsHelper
72
54
  end
73
55
  end
74
56
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module RemixIcon
8
8
  autoload :RailsHelper, 'rubicons/remix_icon/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/remix_icon', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module SimpleIcons
8
8
  autoload :RailsHelper, 'rubicons/simple_icons/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/simple_icons', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module TablerIcons
8
8
  autoload :RailsHelper, 'rubicons/tabler_icons/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/tabler_icons', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Rubicons
2
4
  module ThemifyIcons
3
5
  # Rails view helper for Themify Icons
@@ -1,23 +1,22 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Rubicons
2
4
  module ThemifyIcons
3
5
  autoload :RailsHelper, 'rubicons/themify_icons/rails_helper'
4
6
 
5
- extend BaseIconSet
6
-
7
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
8
7
  ICONS_PATH = File.expand_path('../../icons/themify_icons', __dir__)
9
8
 
10
9
  class << self
11
10
  def icon(name, **options)
12
- render_icon(name, ICONS_PATH, **options)
11
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
13
12
  end
14
13
 
15
14
  def icon!(name, **options)
16
- render_icon!(name, ICONS_PATH, **options)
15
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
17
16
  end
18
17
 
19
18
  def available_icons
20
- available_icons(ICONS_PATH)
19
+ BaseIconSet.available_icons(ICONS_PATH)
21
20
  end
22
21
  end
23
22
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module Typicons
8
8
  autoload :RailsHelper, 'rubicons/typicons/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/typicons', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rubicons
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.1'
5
5
  end
@@ -7,22 +7,19 @@ module Rubicons
7
7
  module WeatherIcons
8
8
  autoload :RailsHelper, 'rubicons/weather_icons/rails_helper'
9
9
 
10
- extend BaseIconSet
11
-
12
- SIZE_MAP = BaseIconSet::DEFAULT_SIZE_MAP.freeze
13
10
  ICONS_PATH = File.expand_path('../../icons/weather_icons', __dir__)
14
11
 
15
12
  class << self
16
13
  def icon(name, **options)
17
- render_icon(name, ICONS_PATH, **options)
14
+ BaseIconSet.render_icon(name, ICONS_PATH, **options)
18
15
  end
19
16
 
20
17
  def icon!(name, **options)
21
- render_icon!(name, ICONS_PATH, **options)
18
+ BaseIconSet.render_icon!(name, ICONS_PATH, **options)
22
19
  end
23
20
 
24
21
  def available_icons
25
- available_icons(ICONS_PATH)
22
+ BaseIconSet.available_icons(ICONS_PATH)
26
23
  end
27
24
  end
28
25
  end
data/lib/rubicons.rb CHANGED
@@ -1,41 +1,39 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rubicons/version'
4
+ require 'rubicons/base_icon_set'
4
5
  require 'rubicons/railtie' if defined?(Rails)
5
6
 
6
7
  module Rubicons
7
- autoload :Lucide, 'rubicons/lucide'
8
- autoload :Radix, 'rubicons/radix'
8
+ # autoload :AntDesign, 'rubicons/ant_design'
9
+ autoload :Bootstrap, 'rubicons/bootstrap'
10
+ autoload :BoxIcons, 'rubicons/box_icons'
9
11
  autoload :CircumIcons, 'rubicons/circum_icons'
12
+ # autoload :CssGg, 'rubicons/css_gg'
13
+ # autoload :Devicons, 'rubicons/devicons'
14
+ autoload :Feather, 'rubicons/feather'
15
+ # autoload :FlatColorIcons, 'rubicons/flat_color_icons'
10
16
  autoload :FontAwesome5, 'rubicons/font_awesome5'
11
17
  autoload :FontAwesome6, 'rubicons/font_awesome6'
18
+ # autoload :GameIcons, 'rubicons/game_icons'
19
+ # autoload :GrommetIcons, 'rubicons/grommet_icons'
20
+ autoload :Heroicons, 'rubicons/heroicons'
21
+ autoload :Heroicons2, 'rubicons/heroicons2'
22
+ # autoload :IcoMoon, 'rubicons/ico_moon'
12
23
  autoload :Ionicons4, 'rubicons/ionicons4'
13
24
  autoload :Ionicons5, 'rubicons/ionicons5'
25
+ autoload :LineAwesome, 'rubicons/line_awesome'
26
+ autoload :Lucide, 'rubicons/lucide'
14
27
  autoload :MaterialDesign, 'rubicons/material_design'
15
- autoload :Typicons, 'rubicons/typicons'
16
28
  autoload :Octicons, 'rubicons/octicons'
17
- autoload :Feather, 'rubicons/feather'
18
- autoload :GameIcons, 'rubicons/game_icons'
19
- autoload :WeatherIcons, 'rubicons/weather_icons'
20
- autoload :Devicons, 'rubicons/devicons'
21
- autoload :AntDesign, 'rubicons/ant_design'
22
- autoload :Bootstrap, 'rubicons/bootstrap'
29
+ autoload :PhosphorIcons, 'rubicons/phosphor_icons'
30
+ autoload :Radix, 'rubicons/radix'
23
31
  autoload :RemixIcon, 'rubicons/remix_icon'
24
- autoload :FlatColorIcons, 'rubicons/flat_color_icons'
25
- autoload :GrommetIcons, 'rubicons/grommet_icons'
26
- autoload :Heroicons, 'rubicons/heroicons'
27
- autoload :Heroicons2, 'rubicons/heroicons2'
28
32
  autoload :SimpleIcons, 'rubicons/simple_icons'
29
- autoload :SimpleLineIcons, 'rubicons/simple_line_icons'
30
- autoload :IcoMoon, 'rubicons/ico_moon'
31
- autoload :BoxIcons, 'rubicons/box_icons'
32
- autoload :CssGg, 'rubicons/css_gg'
33
- autoload :VsCodeIcons, 'rubicons/vs_code_icons'
33
+ # autoload :SimpleLineIcons, 'rubicons/simple_line_icons'
34
34
  autoload :TablerIcons, 'rubicons/tabler_icons'
35
35
  autoload :ThemifyIcons, 'rubicons/themify_icons'
36
- autoload :PhosphorIcons, 'rubicons/phosphor_icons'
37
- autoload :LineAwesome, 'rubicons/line_awesome'
38
-
39
- class << self
40
- end
36
+ autoload :Typicons, 'rubicons/typicons'
37
+ # autoload :VsCodeIcons, 'rubicons/vs_code_icons'
38
+ autoload :WeatherIcons, 'rubicons/weather_icons'
41
39
  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.4.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - insomnius
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-10 00:00:00.000000000 Z
11
+ date: 2025-04-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