inci_score 4.5.1 → 4.5.2

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: c8d0453d792d9a6f5e628d13720a927c15ee14ba8441faf588736b22ab8bf618
4
- data.tar.gz: d354ebb76fa432acc592da8e152e6a9712022c394cce7e8f951e6ebc9f94b93a
3
+ metadata.gz: 9b62e565ea7191b030ebcdf3b278130065ecb325743bf4ca618e0c8e7d7559a8
4
+ data.tar.gz: 0fcbf56e6edb8a314c202200e89d8f53428b009472440d7a1e92815be90b9df9
5
5
  SHA512:
6
- metadata.gz: dcfc4fcafe3b51ed9917937c36055c4043591b499250eae36be97cf4b58d101d0440bc12a57a2fe8e22c5fb4189ed20969cd6f0ab7f58cfa9028fa2ea681fda6
7
- data.tar.gz: a34557698ffc1449c4ae4d4bb031465566506e92186c7a6e482ff655453566581d3645f8e78894d5afec6a3feb6066d887d30063356b6d3a91b408204a1a6ed4
6
+ metadata.gz: 7f4040838f05e804090a2482d3b6ea03c1c4575e5133a0989af9f733c373f6c1c507426196fca5eba539c4fbe5c3322a62e623a1630c8ade6dfe2f056a616938
7
+ data.tar.gz: c14b303bae2a60c0f16b1df28e95e77cf2b32caaa33086d8852edf8486dfccbaf29bb361a7d8c2150eb32a569890c84a812369f13bdd38f61df979a76f18abd2
data/README.md CHANGED
@@ -80,7 +80,7 @@ You can collect INCI data by using the available CLI interface:
80
80
  inci_score --src="ingredients: aqua, dimethicone, pej-10, noent"
81
81
 
82
82
  TOTAL SCORE:
83
- 47.18
83
+ 53.22
84
84
  PRECISION:
85
85
  75.0
86
86
  COMPONENTS:
data/config/catalog.yml CHANGED
@@ -4019,6 +4019,7 @@ prunus avium: 0
4019
4019
  prunus cerasus: 0
4020
4020
  prunus domestica: 0
4021
4021
  prunus dulcis: 0
4022
+ prunus amygdalus dulcis (sweet almond) oil: 0
4022
4023
  prunus persica: 0
4023
4024
  prunus serotina: 0
4024
4025
  prunus spinosa: 0
@@ -4908,6 +4909,7 @@ tripeptide-29: 1
4908
4909
  triphenyl trimethicone: 4
4909
4910
  tripotassium edta: 4
4910
4911
  trisodium edta: 4
4912
+ trisodium ethylenediamine disuccinate: 2
4911
4913
  trisodium hedta: 4
4912
4914
  trisodium lauroampho pg-acetate phosphate chloride: 3
4913
4915
  trisodium methylglycinediacetate: 1
@@ -25,7 +25,7 @@ module InciScore
25
25
  if parenthesis?
26
26
  parenthesis = PARENTHESIS.join
27
27
  parenthesis_values = raw.match(PARENTHESIS_RULE).captures.map { |c| c.delete(parenthesis) }
28
- deparenthesized = raw.sub(PARENTHESIS_RULE, '').sub(/\s+/, ' ').strip
28
+ deparenthesized = raw.sub(PARENTHESIS_RULE, '').sub(/\s{2,}/, ' ').strip
29
29
  [deparenthesized].concat(parenthesis_values)
30
30
  else
31
31
  raw.split(SLASH_RULE).map(&:strip)
@@ -7,7 +7,11 @@ module InciScore
7
7
  module Rules
8
8
  TOLERANCE = 3
9
9
 
10
- Component = Struct.new(:name, :hazard)
10
+ Component = Struct.new(:name, :hazard) do
11
+ def to_s
12
+ "#{name} (#{hazard})"
13
+ end
14
+ end
11
15
 
12
16
  Key = ->(src) do
13
17
  score = Config::CATALOG[src]
@@ -53,7 +57,7 @@ module InciScore
53
57
  def call(src)
54
58
  return if src.size < TOLERANCE
55
59
  digits = src[0, MIN_MEANINGFUL]
56
- pairs = Config::CATALOG.detect { |name, _| name.start_with?(digits) }.to_a.first
60
+ pairs = Config::CATALOG.detect { |name, _| name.start_with?(digits) }
57
61
  Component.new(*pairs) if pairs
58
62
  end
59
63
  end
@@ -41,7 +41,7 @@ PRECISION:
41
41
  return '' if components.empty?
42
42
  %Q{
43
43
  COMPONENTS:
44
- \t#{components.map { |c| "#{c.name} (#{c.hazard})" }.join(', ')}}
44
+ \t#{components.map(&:to_s).join(', ')}}
45
45
  end
46
46
 
47
47
  def unrecognized_str
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InciScore
4
- VERSION = '4.5.1'
4
+ VERSION = '4.5.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inci_score
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.1
4
+ version: 4.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - costajob