zarby 0.1.6 → 0.2.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 +4 -4
- data/.env +2 -0
- data/.tool-versions +1 -0
- data/CHANGELOG.md +9 -0
- data/README.md +94 -13
- data/gem_info.txt +11 -0
- data/lib/zarby/anonymize.rb +42 -0
- data/lib/zarby/csv.rb +14 -3
- data/lib/zarby/img/ceapl.svg +15 -0
- data/lib/zarby/normalize.rb +18 -3
- data/lib/zarby/typo/zarby.ttf +0 -0
- data/lib/zarby/version.rb +1 -1
- data/lib/zarby.rb +15 -1
- data/zarby-0.1.0.gem +0 -0
- data/zarby-0.1.1.gem +0 -0
- data/zarby-0.1.2.gem +0 -0
- data/zarby-0.1.3.gem +0 -0
- data/zarby-0.1.4.gem +0 -0
- data/zarby-0.1.5.gem +0 -0
- data/zarby-0.1.6.gem +0 -0
- data/zarby.gemspec +0 -4
- metadata +16 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 229aff347d8e56857376619b396c040a78af39f15914154e8bdaca9bbb326af2
|
4
|
+
data.tar.gz: d4838dd23e8d3109c98a112f9ef2fbf16171c409a8c4b1c84b8a1cce421e6379
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 587f9808e5c698b87194a130b26a4590c3dcaec119712d955e6ef1005e526f60e486e5a3318f16a197d4be8866f1c1ace8739aa2c74249ffa4e82eff9721dda6
|
7
|
+
data.tar.gz: ac73ffb60b0e355f70f549a7392ce7e939701e8ea9a64c8e33464a9027fb00d97cb6ffd18c46b5de8e0659a4e756d75ede0828d4f2f1388a2fa6aa2c7c0e0ebe
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 3.3.3
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
# 0.2.0 / 2024-06-28
|
2
|
+
|
3
|
+
## Enhancements
|
4
|
+
|
5
|
+
* Poro class Csv and Normalize to symplify syntax
|
6
|
+
* Csv and Normalize class will be private and their method depreciated
|
7
|
+
* Use only instance of Zarby
|
8
|
+
* Add module to anonymise string value.
|
9
|
+
|
1
10
|
# 0.1.5 / 2023-10-24
|
2
11
|
|
3
12
|
## Enhancements
|
data/README.md
CHANGED
@@ -1,31 +1,112 @@
|
|
1
1
|
# Zarby
|
2
2
|
|
3
|
-
|
3
|
+
[](http://badge.fury.io/rb/zarby)
|
4
4
|
|
5
|
-
|
5
|
+
A library to Manipulate String with utiles methods.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
-
|
9
|
+
Run:
|
10
10
|
|
11
|
-
|
11
|
+
bundle add zarby
|
12
12
|
|
13
|
-
|
13
|
+
Or install it yourself as:
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
$ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
15
|
+
$ gem install zarby
|
18
16
|
|
19
17
|
## Usage
|
20
18
|
|
21
|
-
|
19
|
+
Three module are available: CSV, Normelize And Anonymize
|
20
|
+
|
21
|
+
### CSV
|
22
|
+
|
23
|
+
Method do detecte delimiter in csv!
|
24
|
+
|
25
|
+
Since V 0.1.6 (depreciated and removed on 10/2024)
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
Zarby::CSV.detect_delimiter("aa,bb,cc") # => ","
|
29
|
+
Zarby::CSV.detect_delimiter("aa;bb;cc") # => ";"
|
30
|
+
Zarby::CSV.detect_delimiter("aa,bb;cc,dd") # => ","
|
31
|
+
Zarby::CSV.detect_delimiter("aa;bb;cc,dd") # => ";"
|
32
|
+
```
|
33
|
+
Since V 0.1.7
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
Zarby.detect_delimiter("aa,bb,cc") # => ","
|
37
|
+
Zarby.detect_delimiter("aa;bb;cc") # => ";"
|
38
|
+
Zarby.detect_delimiter("aa,bb;cc,dd") # => ","
|
39
|
+
Zarby.detect_delimiter("aa;bb;cc,dd") # => ";"
|
40
|
+
```
|
41
|
+
|
42
|
+
`detect_delimiter`, render the dilimter, define in a csv on XXXX ms.
|
43
|
+
`[',', ';', ':', '|']`, is available by default.
|
44
|
+
|
45
|
+
### Normelize
|
46
|
+
|
47
|
+
Method to utf8 encode all caracters in a string (since widows , sweden enoding, etc ...).
|
48
|
+
|
49
|
+
Since V 0.1.6 (depreciated and removed on 10/2024)
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
Zarby.utf8("Aa\xFCAa\xDF".force_encoding('Windows-1252')) # => "AaüAaß
|
53
|
+
# actually Windows-1252
|
54
|
+
Zarby::Normalize.utf8("Aa\xFCAa\xDF".force_encoding('ASCII-8BIT')) # => "AaüAaß"
|
55
|
+
# actually Windows-1252
|
56
|
+
Zarby::Normalize.utf8("Dur\xC3\xA9e".force_encoding('ASCII-8BIT')) # => "AaüAaß"
|
57
|
+
|
58
|
+
Zarby::Normalize.utf8("Aa\x80Aa\x81".force_encoding('ASCII-8BIT')) # => "AaüAaß"
|
59
|
+
|
60
|
+
```
|
61
|
+
|
62
|
+
Since V 0.1.7
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
Zarby.utf8("Aa\xFCAa\xDF".force_encoding('Windows-1252')) # => "AaüAaß
|
66
|
+
# actually Windows-1252
|
67
|
+
Zarby.utf8("Aa\xFCAa\xDF".force_encoding('ASCII-8BIT')) # => "AaüAaß"
|
68
|
+
# actually Windows-1252
|
69
|
+
Zarby.utf8("Dur\xC3\xA9e".force_encoding('ASCII-8BIT')) # => "AaüAaß"
|
70
|
+
|
71
|
+
Zarby.utf8("Aa\x80Aa\x81".force_encoding('ASCII-8BIT')) # => "AaüAaß"
|
72
|
+
|
73
|
+
```
|
74
|
+
|
75
|
+
### Anonymise
|
76
|
+
|
77
|
+
Method to anonymise a string.
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
Zarby.anonymise("z") # => "**"
|
81
|
+
Zarby.anonymise("za") # => "**"
|
82
|
+
Zarby.anonymise("zar") # => "z*r"
|
83
|
+
Zarby.anonymise("zarb") # => "z**b"
|
84
|
+
Zarby.anonymise("zarby") # => "za*by"
|
85
|
+
arby.anonymise("mewtwo") # => "me**wo"
|
86
|
+
arby.anonymise("Ectoplasma") # => "Ec******ma"
|
87
|
+
```
|
22
88
|
|
23
|
-
|
89
|
+
`anonymise` try to set '*' between two first and two last letter of the string if lenght greater than 4.
|
90
|
+
if string length between 1 to 2, return **.
|
91
|
+
if string length = 3 return a*a.
|
92
|
+
if string length = 4 return a**a.
|
24
93
|
|
25
|
-
|
94
|
+
if "@" is present, render `anonymise` string before and after "@", and kept "@" symbole.
|
95
|
+
exemple:
|
26
96
|
|
27
|
-
|
97
|
+
```ruby
|
98
|
+
Zarby.anonymise("z@z") # => "**@**"
|
99
|
+
Zarby.anonymise("za@za") # => "**@**"
|
100
|
+
Zarby.anonymise("zar@zar") # => "z*r@z*r"
|
101
|
+
Zarby.anonymise("zarb@zarb") # => "z**b@z**b"
|
102
|
+
Zarby.anonymise("zarby@zarby") # => "za*by@za*by"
|
103
|
+
Zarby.anonymise("mewtwo@mewtwo") # => "me**wo@me**wo"
|
104
|
+
Zarby.anonymise("Ectoplasma@Ectoplasma") # => "Ec******ma@Ec******ma"
|
105
|
+
# Using multiple "@"
|
106
|
+
Zarby.anonymise("pichu@pikachu@raichu") # => "pi*hu@pi***hu@ra**hu"
|
107
|
+
Zarby.anonymise("@fantominus@spectrum@ectoplasma@") # => "**@fa******us@sp****um@ec******ma"
|
108
|
+
```
|
28
109
|
|
29
110
|
## Contributing
|
30
111
|
|
31
|
-
Bug
|
112
|
+
Bug report and pull request are welcome on GitHub at https://github.com/zarby-ruby/zarby.
|
data/gem_info.txt
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Zarby
|
4
|
+
# this class is used to anonymise string on replace char with *
|
5
|
+
class Anonymize
|
6
|
+
def initialize(input: , nb_chars: 2, mask_with: '*')
|
7
|
+
@input = input
|
8
|
+
@nb_chars = nb_chars
|
9
|
+
@mask_with = mask_with
|
10
|
+
end
|
11
|
+
|
12
|
+
# @return [String]
|
13
|
+
def call
|
14
|
+
raise ArgumentError, "nb_chars must be greater then or equal to zero" if @nb_chars.negative?
|
15
|
+
|
16
|
+
@input.include?("@") ? with_comercial_at : with_default_chars(@input)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
# @param input [String]
|
22
|
+
# @return [String]
|
23
|
+
def with_default_chars(input)
|
24
|
+
if input.length < 3
|
25
|
+
"**"
|
26
|
+
elsif input.length <= @nb_chars * 2
|
27
|
+
@nb_chars -= 1
|
28
|
+
with_default_chars(input)
|
29
|
+
else
|
30
|
+
input.sub(
|
31
|
+
/\A(.{#{@nb_chars}})(.*)(.{#{@nb_chars}})\z/,
|
32
|
+
"\\1#{@mask_with * (input.length - (@nb_chars * 2))}\\3"
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# @return [String]
|
38
|
+
def with_comercial_at
|
39
|
+
@input.split("@").map{ |v| with_default_chars(v) }.join("@")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/zarby/csv.rb
CHANGED
@@ -5,6 +5,8 @@ module Zarby
|
|
5
5
|
|
6
6
|
# this class is used to detect the column separator in a CSV file
|
7
7
|
class Csv
|
8
|
+
extend Gem::Deprecate
|
9
|
+
|
8
10
|
COMMON_DELIMITERS = ['","', '";"', '":"', '"|"'].freeze
|
9
11
|
|
10
12
|
# @param [String] content
|
@@ -13,16 +15,25 @@ module Zarby
|
|
13
15
|
@content = content || ""
|
14
16
|
end
|
15
17
|
|
16
|
-
# @param [String] content
|
17
18
|
# @return [String]
|
18
|
-
def
|
19
|
-
|
19
|
+
def call
|
20
|
+
valid? ? delimiters[0][0][1] : raise(Zarby::NoColSepDetected)
|
20
21
|
end
|
21
22
|
|
22
23
|
# @return [String]
|
23
24
|
def detect_separator
|
24
25
|
valid? ? delimiters[0][0][1] : raise(Zarby::NoColSepDetected)
|
25
26
|
end
|
27
|
+
deprecate :detect_separator, 'Zarby#detect_separator(.string)', 2024, 10
|
28
|
+
|
29
|
+
class << self
|
30
|
+
# @param [String] content
|
31
|
+
# @return [String]
|
32
|
+
def detect_separator(content)
|
33
|
+
new(content: content).detect_separator
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
26
37
|
|
27
38
|
private
|
28
39
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<svg width="1544" height="255" viewBox="0 0 1544 255" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path d="M285.127 199.975C267.153 199.975 251.426 196.606 237.945 189.867C224.652 182.942 214.26 173.583 206.771 161.791C199.469 149.811 195.818 136.241 195.818 121.079C195.818 105.918 199.375 92.441 206.49 80.6488C213.792 68.6693 223.809 59.404 236.541 52.8527C249.273 46.1143 263.596 42.7451 279.511 42.7451C294.489 42.7451 308.157 45.8336 320.514 52.0105C332.872 58.0002 342.701 66.8911 350.003 78.6834C357.305 90.4756 360.956 104.795 360.956 121.641C360.956 123.513 360.863 125.665 360.676 128.098C360.488 130.532 360.301 132.778 360.114 134.837H249.514L248.733 106.76H311.033H331.748H316.461C316.461 106.76 313.199 106.76 311.033 106.76C310.426 103.054 309.28 99.6848 307.595 96.6525C304.974 91.5987 301.229 87.6679 296.361 84.8602C291.681 82.0526 286.157 80.6488 279.791 80.6488C273.426 80.6488 267.809 82.0526 262.941 84.8602C258.26 87.6679 254.609 91.6923 251.987 96.9333C249.366 101.987 248.056 107.977 248.056 114.902V123.045C248.056 130.532 249.553 136.989 252.549 142.418C255.732 147.846 260.226 152.057 266.03 155.052C271.834 157.86 278.762 159.264 286.813 159.264C294.302 159.264 300.668 158.234 305.91 156.175C311.34 153.929 316.676 150.56 321.919 146.068L350.003 175.267C342.701 183.316 333.714 189.493 323.042 193.798C312.37 197.916 299.732 199.975 285.127 199.975Z" fill="#0A6C49"/>
|
3
|
+
<path d="M463.354 199.975C446.503 199.975 431.431 196.606 418.137 189.867C405.031 183.129 394.733 173.864 387.244 162.071C379.755 150.092 376.01 136.428 376.01 121.079C376.01 105.731 379.755 92.1602 387.244 80.368C394.733 68.5757 405.031 59.404 418.137 52.8527C431.431 46.1143 446.503 42.7451 463.354 42.7451C480.579 42.7451 495.464 46.3951 508.009 53.6951C520.553 60.995 529.447 71.2898 534.689 84.5795L493.405 105.637C489.847 98.5243 485.447 93.3769 480.205 90.1948C474.962 86.8256 469.252 85.141 463.073 85.141C456.894 85.141 451.278 86.5449 446.222 89.3525C441.167 92.1602 437.142 96.2781 434.146 101.706C431.337 106.947 429.933 113.405 429.933 121.079C429.933 128.941 431.337 135.586 434.146 141.014C437.142 146.442 441.167 150.56 446.222 153.368C451.278 156.175 456.894 157.579 463.073 157.579C469.252 157.579 474.962 155.988 480.205 152.806C485.447 149.437 489.847 144.196 493.405 137.083L534.689 158.141C529.447 171.43 520.553 181.725 508.009 189.025C495.464 196.325 480.579 199.975 463.354 199.975Z" fill="#0A6C49"/>
|
4
|
+
<path d="M578.157 254.444C570.106 254.444 561.962 253.134 553.723 250.513C545.672 248.08 539.119 244.804 534.064 240.686L552.6 203.344C555.783 206.152 559.434 208.304 563.553 209.802C567.859 211.486 572.072 212.329 576.191 212.329C581.995 212.329 586.583 211.019 589.953 208.398C593.323 205.778 596.225 201.66 598.659 196.044L605.68 178.356L609.893 173.021L661.569 45.272H712.402L646.684 203.625C641.442 216.727 635.356 226.929 628.429 234.229C621.689 241.716 614.106 246.957 605.68 249.952C597.442 252.947 588.268 254.444 578.157 254.444Z" fill="#0A6C49"/>
|
5
|
+
<path d="M531.818 45.2744L598.94 203.908L636.012 168.251L586.583 45.2744H531.818Z" fill="#0A6C49"/>
|
6
|
+
<path d="M1488.37 138.623H1544L1534.88 194.254H1479.25L1488.37 138.623Z" fill="#E16253"/>
|
7
|
+
<rect x="244.414" y="106.703" width="5.47194" height="28.2717" fill="#0A6C49"/>
|
8
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M75.4254 128.624L72.8784 124.9H132.248L138.981 134.687C138.156 135.083 137.317 135.47 136.466 135.845C127.088 139.913 116.379 142.507 104.341 143.627L101.982 147.009L75.4254 128.624ZM97.0459 160.23L97.4436 160.505C99.9573 162.245 102.899 163.263 105.95 163.451C109.001 163.638 112.045 162.987 114.753 161.569C117.461 160.15 119.729 158.018 121.312 155.403C121.429 155.209 121.542 155.014 121.651 154.817C128.798 153.276 135.562 151.149 141.91 148.396L141.952 148.377L141.994 148.359C143.636 147.634 145.243 146.872 146.816 146.075L181.489 196.472H121.837L97.0459 160.23Z" fill="#0A6C49"/>
|
9
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 196.471V0H90.0395C108.047 0 123.523 2.90029 136.466 8.70086C149.597 14.5014 159.726 22.9216 166.854 33.9614C173.983 44.8141 177.547 57.7251 177.547 72.6943C177.547 87.4764 173.983 100.294 166.854 111.146C159.726 121.812 149.597 130.045 136.466 135.846C128.598 139.258 119.793 141.633 110.053 142.971V146.728C110.053 147.289 109.899 147.839 109.609 148.319C109.318 148.799 108.902 149.191 108.405 149.451C107.908 149.712 107.349 149.831 106.789 149.797C106.229 149.762 105.689 149.575 105.227 149.256L65.244 121.575C64.8367 121.291 64.504 120.913 64.2743 120.472C64.0446 120.032 63.9246 119.542 63.9246 119.046C63.9246 118.549 64.0446 118.059 64.2743 117.619C64.504 117.179 64.8367 116.8 65.244 116.516L105.227 88.8351C105.689 88.5157 106.229 88.3287 106.79 88.2944C107.35 88.2601 107.909 88.3799 108.406 88.6406C108.903 88.9014 109.319 89.2933 109.61 89.7737C109.9 90.2542 110.053 90.805 110.053 91.3664V95.6887C110.942 95.0887 111.774 94.4407 112.549 93.7447C118.364 88.6926 121.272 81.6758 121.272 72.6943C121.272 63.5256 118.364 56.4153 112.549 51.3631C106.922 46.311 98.2931 43.785 86.663 43.785H55.7119V101.323V144.266V196.471H0Z" fill="#0A6C49"/>
|
10
|
+
<path d="M815.969 193.765C804.567 193.765 794.656 191.565 786.237 187.167C777.817 182.592 771.677 175.291 767.818 165.262C763.959 155.233 763.082 141.862 765.187 125.147C766.941 108.785 770.713 94.7093 776.501 82.9211C782.465 71.133 790.183 62.072 799.656 55.7381C809.303 49.2282 820.442 45.9733 833.072 45.9733C843.421 45.9733 853.157 48.5245 862.278 53.6268C871.575 58.7291 879.03 66.1187 884.644 75.7955C890.432 85.2964 893.326 96.9965 893.326 110.896C893.326 122.86 891.309 133.856 887.275 143.885C883.24 153.914 877.627 162.711 870.435 170.276C863.418 177.666 855.262 183.472 845.965 187.695C836.668 191.741 826.669 193.765 815.969 193.765ZM708.616 242.589L747.295 48.3485H794.656L789.657 72.3646L780.448 119.605L773.87 166.582L758.609 242.589H708.616ZM808.865 153.386C815.531 153.386 821.407 151.714 826.494 148.372C831.581 145.029 835.528 140.366 838.334 134.384C841.316 128.402 842.807 121.452 842.807 113.535C842.807 105.266 840.439 98.668 835.703 93.7416C830.967 88.6393 824.301 86.0881 815.706 86.0881C809.216 86.0881 803.339 87.8475 798.077 91.3664C792.99 94.7093 788.956 99.3717 785.974 105.354C783.167 111.336 781.764 118.285 781.764 126.203C781.764 134.472 784.132 141.07 788.868 145.996C793.604 150.923 800.27 153.386 808.865 153.386Z" fill="#E16253"/>
|
11
|
+
<path d="M966.819 193.765C956.645 193.765 946.91 191.213 937.613 186.111C928.316 181.009 920.773 173.619 914.985 163.942C909.371 154.266 906.565 142.478 906.565 128.578C906.565 116.614 908.582 105.618 912.616 95.589C916.651 85.5603 922.176 76.8511 929.193 69.4616C936.385 62.072 944.629 56.3539 953.926 52.3072C963.399 48.0846 973.397 45.9733 983.922 45.9733C995.499 45.9733 1005.41 48.2606 1013.65 52.835C1022.07 57.2336 1028.21 64.4472 1032.07 74.4759C1035.93 84.3287 1036.81 97.7003 1034.7 114.591C1033.13 130.601 1029.35 144.589 1023.39 156.553C1017.43 168.517 1009.71 177.754 1000.24 184.264C990.763 190.598 979.624 193.765 966.819 193.765ZM984.185 153.386C990.851 153.386 996.727 151.714 1001.81 148.372C1006.9 145.029 1010.85 140.366 1013.65 134.384C1016.64 128.402 1018.13 121.452 1018.13 113.535C1018.13 105.266 1015.76 98.668 1011.02 93.7416C1006.29 88.6393 999.621 86.0881 991.026 86.0881C984.536 86.0881 978.66 87.8475 973.397 91.3664C968.31 94.7093 964.276 99.3717 961.294 105.354C958.487 111.336 957.084 118.285 957.084 126.203C957.084 134.472 959.452 141.07 964.188 145.996C968.924 150.923 975.59 153.386 984.185 153.386ZM1005.23 191.389L1010.23 167.373L1019.71 120.133L1026.02 72.8924L1031.02 48.3485H1081.01L1052.6 191.389H1005.23Z" fill="#E16253"/>
|
12
|
+
<path d="M1084.78 191.389L1113.2 48.3485H1160.56L1152.4 88.9911L1147.66 77.379C1153.98 65.9427 1162.31 57.8494 1172.66 53.099C1183.01 48.3485 1195.11 45.9733 1208.97 45.9733L1200.29 91.1024C1198.18 90.7506 1196.25 90.5746 1194.5 90.5746C1192.75 90.3987 1190.9 90.3107 1188.97 90.3107C1178.1 90.3107 1169.15 92.9498 1162.14 98.2281C1155.3 103.33 1150.73 111.864 1148.45 123.828L1134.77 191.389H1084.78Z" fill="#E16253"/>
|
13
|
+
<path d="M1268.44 193.765C1257.39 193.765 1247.92 191.653 1240.02 187.431C1232.13 183.032 1226.52 176.698 1223.18 168.429C1219.85 159.984 1219.32 149.955 1221.6 138.343L1245.81 16.415H1295.8L1271.6 138.079C1270.72 143.533 1271.33 147.756 1273.44 150.747C1275.54 153.562 1279.14 154.969 1284.23 154.969C1286.86 154.969 1289.4 154.618 1291.86 153.914C1294.31 153.21 1296.77 152.154 1299.22 150.747L1305.54 185.319C1300.28 188.31 1294.4 190.422 1287.91 191.653C1281.6 193.061 1275.1 193.765 1268.44 193.765ZM1210.03 91.1024L1217.66 53.6268H1320.8L1313.43 91.1024H1210.03Z" fill="#E16253"/>
|
14
|
+
<path d="M1378.76 193.765C1366.13 193.765 1354.2 192.445 1342.97 189.806C1331.75 186.991 1323.06 183.648 1316.92 179.777L1335.08 144.677C1341.74 148.899 1349.55 152.154 1358.5 154.442C1367.44 156.729 1376.12 157.872 1384.54 157.872C1392.79 157.872 1398.67 156.993 1402.17 155.233C1405.68 153.298 1407.44 150.747 1407.44 147.58C1407.44 144.765 1405.59 142.741 1401.91 141.51C1398.4 140.102 1393.84 138.959 1388.23 138.079C1382.62 137.199 1376.65 136.056 1370.34 134.648C1364.2 133.241 1358.32 131.217 1352.71 128.578C1347.09 125.939 1342.45 122.244 1338.76 117.494C1335.25 112.567 1333.5 106.058 1333.5 97.9642C1333.5 86.528 1336.83 76.9391 1343.5 69.1977C1350.16 61.4562 1359.2 55.6501 1370.6 51.7794C1382.18 47.9087 1395.16 45.9733 1409.54 45.9733C1419.72 45.9733 1429.54 46.941 1439.01 48.8764C1448.48 50.8117 1456.73 53.6268 1463.74 57.3216L1446.11 92.422C1439.1 88.1994 1431.91 85.3843 1424.54 83.9768C1417.17 82.3933 1410.24 81.6016 1403.75 81.6016C1395.51 81.6016 1389.63 82.6572 1386.12 84.7685C1382.62 86.8798 1380.86 89.431 1380.86 92.422C1380.86 95.0611 1382.62 97.1725 1386.12 98.7559C1389.81 100.163 1394.37 101.395 1399.81 102.451C1405.42 103.33 1411.38 104.474 1417.7 105.882C1424.01 107.113 1429.89 109.049 1435.33 111.688C1440.94 114.327 1445.5 118.022 1449.01 122.772C1452.69 127.522 1454.53 133.944 1454.53 142.038C1454.53 153.298 1451.11 162.799 1444.27 170.54C1437.61 178.282 1428.57 184.088 1417.17 187.959C1405.77 191.829 1392.96 193.765 1378.76 193.765Z" fill="#E16253"/>
|
15
|
+
</svg>
|
data/lib/zarby/normalize.rb
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
module Zarby
|
4
4
|
# this class is used to normalize the input string to UTF-8
|
5
5
|
class Normalize
|
6
|
+
extend Gem::Deprecate
|
7
|
+
|
6
8
|
# utf-8 converting from the string's given encoding
|
7
9
|
COMMON_ENCODINGS = %w[UTF-8 Windows-1252 ASCII-8BIT ISO-8859-1 US-ASCII].freeze
|
8
10
|
|
@@ -12,10 +14,14 @@ module Zarby
|
|
12
14
|
@input = input&.force_encoding(Encoding::UTF_8) || ''
|
13
15
|
end
|
14
16
|
|
15
|
-
# @param input [String]
|
16
17
|
# @return [String]
|
17
|
-
def
|
18
|
-
|
18
|
+
def call
|
19
|
+
output = @input if valid?
|
20
|
+
|
21
|
+
|
22
|
+
output ||= @input.force_encoding(Encoding::ISO_8859_1).encode!(Encoding::UTF_8)
|
23
|
+
rescue Encoding::UndefinedConversionError, Encoding::InvalidByteSequenceError
|
24
|
+
nil
|
19
25
|
end
|
20
26
|
|
21
27
|
# @return [String]
|
@@ -27,6 +33,15 @@ module Zarby
|
|
27
33
|
rescue Encoding::UndefinedConversionError, Encoding::InvalidByteSequenceError
|
28
34
|
nil
|
29
35
|
end
|
36
|
+
deprecate :utf8, 'Zarby#utf8(.string)', 2024, 10
|
37
|
+
|
38
|
+
class << self
|
39
|
+
# @param input [String]
|
40
|
+
# @return [String]
|
41
|
+
def utf8(input)
|
42
|
+
new(input: input).utf8
|
43
|
+
end
|
44
|
+
end
|
30
45
|
|
31
46
|
private
|
32
47
|
|
Binary file
|
data/lib/zarby/version.rb
CHANGED
data/lib/zarby.rb
CHANGED
@@ -3,7 +3,21 @@
|
|
3
3
|
require_relative 'zarby/version'
|
4
4
|
require_relative 'zarby/csv'
|
5
5
|
require_relative 'zarby/normalize'
|
6
|
+
require_relative 'zarby/anonymize'
|
6
7
|
|
7
8
|
module Zarby
|
8
|
-
|
9
|
+
def anonymise(input, nb_chars: 2, mask_with: '*')
|
10
|
+
Anonymize.new(input:, nb_chars: nb_chars, mask_with: mask_with).call
|
11
|
+
end
|
12
|
+
|
13
|
+
def detect_separator(content)
|
14
|
+
Csv.new(content:).call
|
15
|
+
end
|
16
|
+
|
17
|
+
def utf8(input)
|
18
|
+
Normalize.new(input:).call
|
19
|
+
end
|
20
|
+
|
21
|
+
module_function :anonymise, :detect_separator, :utf8
|
22
|
+
private_constant :Anonymize
|
9
23
|
end
|
data/zarby-0.1.0.gem
ADDED
Binary file
|
data/zarby-0.1.1.gem
ADDED
Binary file
|
data/zarby-0.1.2.gem
ADDED
Binary file
|
data/zarby-0.1.3.gem
ADDED
Binary file
|
data/zarby-0.1.4.gem
ADDED
Binary file
|
data/zarby-0.1.5.gem
ADDED
Binary file
|
data/zarby-0.1.6.gem
ADDED
Binary file
|
data/zarby.gemspec
CHANGED
@@ -36,8 +36,4 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.bindir = "exe"
|
37
37
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
38
38
|
spec.require_paths = ["lib"]
|
39
|
-
|
40
|
-
# Uncomment to register a new dependency of your gem
|
41
|
-
# For more information and examples about making a new gem, check out our
|
42
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
43
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zarby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vianney.sonneville
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -17,15 +17,28 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- ".env"
|
21
|
+
- ".tool-versions"
|
20
22
|
- CHANGELOG.md
|
21
23
|
- LICENSE
|
22
24
|
- README.md
|
23
25
|
- Rakefile
|
26
|
+
- gem_info.txt
|
24
27
|
- lib/zarby.rb
|
28
|
+
- lib/zarby/anonymize.rb
|
25
29
|
- lib/zarby/csv.rb
|
30
|
+
- lib/zarby/img/ceapl.svg
|
26
31
|
- lib/zarby/normalize.rb
|
32
|
+
- lib/zarby/typo/zarby.ttf
|
27
33
|
- lib/zarby/version.rb
|
28
34
|
- sig/zarby.rbs
|
35
|
+
- zarby-0.1.0.gem
|
36
|
+
- zarby-0.1.1.gem
|
37
|
+
- zarby-0.1.2.gem
|
38
|
+
- zarby-0.1.3.gem
|
39
|
+
- zarby-0.1.4.gem
|
40
|
+
- zarby-0.1.5.gem
|
41
|
+
- zarby-0.1.6.gem
|
29
42
|
- zarby.gemspec
|
30
43
|
homepage: https://guides.rubygems.org
|
31
44
|
licenses:
|
@@ -49,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
62
|
- !ruby/object:Gem::Version
|
50
63
|
version: '0'
|
51
64
|
requirements: []
|
52
|
-
rubygems_version: 3.
|
65
|
+
rubygems_version: 3.5.14
|
53
66
|
signing_key:
|
54
67
|
specification_version: 4
|
55
68
|
summary: String encoding and decoding with Ruby.
|