healthicons 0.0.5 → 0.0.7

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: 3824e947983c38d4c4692effa4aa242b0bdbacb8190ddf4d52f064bb1a11e579
4
- data.tar.gz: ee4a9cd2b6f394d07d602ec5681fab2281c338eaab9f0c2c40d31ac8cf4ff42b
3
+ metadata.gz: cbd073520f4ddc99a699018401af47a004cff409d9e536a7673ba7405374c28a
4
+ data.tar.gz: 95f6d7d03b9694b1f4a80c61483e546ce07cd33cc5f4bfcff23e3e4853f2afb1
5
5
  SHA512:
6
- metadata.gz: aa25f7899af4557c444e0c536e13e958da1cfa0bd7f0489a166993ad8d316f572a69b8394607dee2e97c260938091d82c3f258b71c9a8f9d713492d940f81335
7
- data.tar.gz: 13a531903179111bbab838937057bef88d215ad4e13105475009f360fd06d28da1f7299089f3f80c75f6c918c98f2ea891a905225113841197d01e406274a9a4
6
+ metadata.gz: 6553af313372e2ec25b5a4a3cdc1553f4b254f9b3b4c1b0c22dbef7b9e12ec6c6e249467b192b60ebe1b8fcaa739758e1dbe34481fd4a521d536f3dae9b11b96
7
+ data.tar.gz: 65f10c2e90b01597db234b23fb72205987ddd109ebb11704e20e916c29d9366692325abff58e7a2946185ae644a186b02a723aeead3ce551e6f7dd5c2936e02f
data/CHANGELOG.md CHANGED
@@ -1,13 +1,32 @@
1
1
  # Changelog
2
+
2
3
  All notable changes to this project will be documented in this file.
3
4
 
4
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
7
 
8
+ ## [0.0.7] - 2023-1130
9
+
10
+ - Resolve `Healthicons::Errors::UnknownIcon` not properly passing error message
11
+ - Update gemspec to support Rails 7+
12
+ - Update Gemfile.lock
13
+ - Include `activesupport/blank` require for some instances where `blank?` may be unavailable
14
+ - Resolve issue were tests are failing for some version of nokogiri
15
+ - Version bump
16
+
17
+ ## [0.0.6] - 2021-11-15
18
+
19
+ - FIXED: When the icons SVG tags are parsed it should conver `<path />` to `<path></path>` to fix and issue with IE not recognising path as a self-closing tag.
20
+
21
+ ## [0.0.5] - 2021-07-27
22
+
23
+ - CHANGED: Updated icons to include healthicons latest SVG changes and newly added icons
24
+ - CHANGED: Version bump since so many of the icon files changed
25
+
7
26
  ## [0.0.4] - 2021-07-9
8
27
 
9
- - CHANGED: Removing adding varient attribute to SVG/XML when a variant is specified
10
- - FIXED: mispelling of `variant` so all icons were being defaulted to to `:outline`
28
+ - CHANGED: Removing adding variant attribute to SVG/XML when a variant is specified
29
+ - FIXED: misspelling of `variant` so all icons were being defaulted to to `:outline`
11
30
 
12
31
  ## [0.0.1] - 2021-06-30
13
32
 
@@ -7,7 +7,7 @@ module Healthicons
7
7
  #
8
8
  # @param icon [String]
9
9
  # @return [String]
10
- def initilize(icon = '')
10
+ def initialize(icon = '')
11
11
  msg = "The #{icon} icon could not be found."
12
12
  super(msg)
13
13
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/core_ext/object/blank'
4
+
3
5
  module Healthicons
4
6
  class Icon
5
7
  VARIANTS = %i[outline solid].freeze
@@ -74,7 +76,7 @@ module Healthicons
74
76
  # @return [String] SVG/XML file contents
75
77
  def svg_file_contents
76
78
  @_svg_file_contents ||= if File.exist?(file_path)
77
- File.open(file_path).read.force_encoding('UTF-8')
79
+ File.read(file_path).force_encoding('UTF-8')
78
80
  else
79
81
  raise Healthicons::Errors::UnknownIcon, "Icon '#{@name}' could not be found."
80
82
  end
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'nokogiri'
4
+ require 'active_support/core_ext/object/blank'
4
5
 
5
6
  module Healthicons
6
7
  class Transform
7
- DEFAULT_OPTIONS = { 'aria-hidden' => true, focusable: false, role: 'img', size: 24 }.freeze
8
+ DEFAULT_OPTIONS = { 'aria-hidden' => true, stroke: 'currentColor', focusable: false, role: 'img', size: 24 }.freeze
8
9
  HEIGHT_AND_WIDTH = %i[height width].freeze
9
10
  KEYS_TO_REMOVE = %i[height width variant viewbox xmlns].freeze
10
11
 
@@ -33,7 +34,8 @@ module Healthicons
33
34
  return '' if @svg.blank?
34
35
 
35
36
  add_icon_options
36
- @svg&.to_xml
37
+ # used to ensure icons with missing </path> have it added to ensure IE compatibiltiy
38
+ @svg&.to_html(&:no_empty_tags)
37
39
  end
38
40
 
39
41
  private
@@ -75,7 +77,8 @@ module Healthicons
75
77
  return if @options.blank? || !options.is_a?(Hash)
76
78
 
77
79
  set_size_and_width
78
- @options.reject { |k| k == :size }.each do |key, val|
80
+ @options = @options.reject { |k| k == :size }
81
+ @options.each do |key, val|
79
82
  set_icon_attribute(key, val)
80
83
  end
81
84
  end
@@ -106,7 +109,7 @@ module Healthicons
106
109
  # https://nokogiri.org/rdoc/Nokogiri/XML/Builder.html
107
110
  # https://www.rubydoc.info/github/sparklemotion/nokogiri/Nokogiri/XML/Node
108
111
  def parse_icon_content(icon_contents)
109
- Nokogiri::HTML::DocumentFragment.parse(icon_contents)
112
+ Nokogiri::HTML::DocumentFragment.parse(icon_contents) # allow it's child attributes/tags to be accessible
110
113
  rescue
111
114
  ''
112
115
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Healthicons
4
- VERSION = '0.0.5'
4
+ VERSION = '0.0.7'
5
5
  end
data/lib/healthicons.rb CHANGED
@@ -7,6 +7,7 @@ require_relative 'healthicons/icon'
7
7
  require_relative 'healthicons/transform' # Used for adding, modifying, and/or modifying attributes to the SVG icon
8
8
  require_relative 'healthicons/rails/railtie' # Used to initialize and lazyload the applications views
9
9
  require_relative 'healthicons/rails/view_helpers'
10
+ require 'active_support/core_ext/object/blank'
10
11
 
11
12
  module Healthicons
12
13
  class Error < StandardError; end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: healthicons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Hicks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-27 00:00:00.000000000 Z
11
+ date: 2023-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -1005,7 +1005,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1005
1005
  - !ruby/object:Gem::Version
1006
1006
  version: '0'
1007
1007
  requirements: []
1008
- rubygems_version: 3.2.11
1008
+ rubygems_version: 3.4.22
1009
1009
  signing_key:
1010
1010
  specification_version: 4
1011
1011
  summary: An application helper to add healthicon SVG icons to your applications views.