clean-this-dirty-string 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ac79d832ade34c46c0aca819a51423d8bd83ce54e53a67dceff31c3dd62aed11
4
+ data.tar.gz: e2b218bf8f8b5f2b99a85ac2384f6596ae017192e434d73a85bd32026d25b186
5
+ SHA512:
6
+ metadata.gz: c5ecc218b7381576e0af11d1648e234d3096f414e3ae9857d766b1a0a0f7f0a6f0ae1649d60763d93cf7f73580edf6e2c07f4ddaec106ecb3d26348c2378ddf7
7
+ data.tar.gz: 3ab4c1c6df668d9662b6c5ac23967c86883bf73573fb9bfd3963139c967b4678346b3b1c530452ae35477b8c2b52ffcd4b289c52f5f10ef05cf954e8a3ecd32f
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ /tmp/*
2
+ !/tmp/.keep
3
+ /.idea
4
+ .DS_Store
5
+
data/Gemfile.lock ADDED
@@ -0,0 +1,26 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ clean-this-dirty-string (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ coderay (1.1.2)
10
+ method_source (0.9.0)
11
+ minitest (5.11.3)
12
+ pry (0.11.3)
13
+ coderay (~> 1.1.0)
14
+ method_source (~> 0.9.0)
15
+
16
+ PLATFORMS
17
+ ruby
18
+
19
+ DEPENDENCIES
20
+ bundler
21
+ clean-this-dirty-string!
22
+ minitest
23
+ pry
24
+
25
+ BUNDLED WITH
26
+ 1.16.2
data/README.md ADDED
@@ -0,0 +1,10 @@
1
+ # clean-this-dirty-string
2
+ ## test
3
+ ```ruby
4
+ ruby ./test/clean_this_dirty_string_test.rb
5
+ ```
6
+
7
+ ## most popular chars
8
+ ```ruby
9
+ cat ./most_popular_chars.txt
10
+ ```
@@ -0,0 +1,17 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'clean-this-dirty-string'
3
+ s.version = '0.0.1'
4
+ s.date = '2018-08-28'
5
+ s.summary = 'It cleans your dirty string'
6
+ s.files = `git ls-files -z`.split("\x0").reject do |f|
7
+ f.match(%r{^(test|spec|features)/})
8
+ end
9
+ s.require_paths = ['lib']
10
+ s.authors = ['Dmitry Sadovnikov']
11
+ s.email = ['sadovnikov.js@gmail.com']
12
+ s.homepage = 'https://github.com/DmitrySadovnikov/clean-this-dirty-string'
13
+
14
+ s.add_development_dependency 'bundler'
15
+ s.add_development_dependency 'minitest'
16
+ s.add_development_dependency 'pry'
17
+ end
data/gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
@@ -0,0 +1,32 @@
1
+ module CleanThisDirtyString
2
+ module_function
3
+
4
+ def clean!(string)
5
+ chars = string.split('')
6
+
7
+ result =
8
+ chars.map do |char|
9
+ case char
10
+ when /[\t\n\r]/ then ' '
11
+ when /[а-ё\d\w\s\!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\; \< \= \> \? \@\[\\\]\^\_\`\{\|\}]/i then char
12
+ when /[\«\»\˝\“\”\„\《\》]/ then '"'
13
+ when /[\­\–\—\-]/ then '-'
14
+ when /[\´]/ then '`'
15
+ when /[\‘\’]/ then "'"
16
+ when /[\℅]/ then '%'
17
+ when /[\№]/ then '№'
18
+ when /[\!]/ then '!'
19
+ when /[\#]/ then '#'
20
+ when /[\(]/ then '('
21
+ when /[\)]/ then ')'
22
+ when /[\,]/ then ','
23
+ when /[\;]/ then ';'
24
+ when /[\<]/ then '<'
25
+ when /[\>]/ then '>'
26
+ else ''
27
+ end
28
+ end
29
+
30
+ result.join('')
31
+ end
32
+ end
@@ -0,0 +1,240 @@
1
+
2
+
3
+
4
+
5
+
6
+ !
7
+ "
8
+ #
9
+ $
10
+ %
11
+ &
12
+ '
13
+ (
14
+ )
15
+ *
16
+ +
17
+ ,
18
+ -
19
+ .
20
+ /
21
+ 0
22
+ 1
23
+ 2
24
+ 3
25
+ 4
26
+ 5
27
+ 6
28
+ 7
29
+ 8
30
+ 9
31
+ :
32
+ ;
33
+ <
34
+ =
35
+ >
36
+ ?
37
+ @
38
+ A
39
+ B
40
+ C
41
+ D
42
+ E
43
+ F
44
+ G
45
+ H
46
+ I
47
+ J
48
+ K
49
+ L
50
+ M
51
+ N
52
+ O
53
+ P
54
+ Q
55
+ R
56
+ S
57
+ T
58
+ U
59
+ V
60
+ W
61
+ X
62
+ Y
63
+ Z
64
+ [
65
+ \
66
+ ]
67
+ ^
68
+ _
69
+ `
70
+ a
71
+ b
72
+ c
73
+ d
74
+ e
75
+ f
76
+ g
77
+ h
78
+ i
79
+ j
80
+ k
81
+ l
82
+ m
83
+ n
84
+ o
85
+ p
86
+ q
87
+ r
88
+ s
89
+ t
90
+ u
91
+ v
92
+ w
93
+ x
94
+ y
95
+ z
96
+ {
97
+ |
98
+ }
99
+  
100
+ £
101
+ ¤
102
+ «
103
+ ­
104
+ ®
105
+ °
106
+ ²
107
+ ³
108
+ ´
109
+ ¹
110
+ º
111
+ »
112
+ ×
113
+ ë
114
+ ˝
115
+ ̆
116
+ Ё
117
+ А
118
+ Б
119
+ В
120
+ Г
121
+ Д
122
+ Е
123
+ Ж
124
+ З
125
+ И
126
+ Й
127
+ К
128
+ Л
129
+ М
130
+ Н
131
+ О
132
+ П
133
+ Р
134
+ С
135
+ Т
136
+ У
137
+ Ф
138
+ Х
139
+ Ц
140
+ Ч
141
+ Ш
142
+ Щ
143
+ Ъ
144
+ Ы
145
+ Ь
146
+ Э
147
+ Ю
148
+ Я
149
+ а
150
+ б
151
+ в
152
+ г
153
+ д
154
+ е
155
+ ж
156
+ з
157
+ и
158
+ й
159
+ к
160
+ л
161
+ м
162
+ н
163
+ о
164
+ п
165
+ р
166
+ с
167
+ т
168
+ у
169
+ ф
170
+ х
171
+ ц
172
+ ч
173
+ ш
174
+ щ
175
+ ъ
176
+ ы
177
+ ь
178
+ э
179
+ ю
180
+ я
181
+ ё
182
+ є
183
+ ү
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+ 
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+ 🍷
220
+ 🍸
221
+ 🍹
222
+ 🎃
223
+ 🏻
224
+ 🏼
225
+ 🏾
226
+ 🐥
227
+ 👆
228
+ 💕
229
+ 💜
230
+ 💪
231
+ 💰
232
+ 💵
233
+ 😂
234
+ 😇
235
+ 😊
236
+ 😋
237
+ 😎
238
+ 😘
239
+ 😜
240
+ 🤘
data/tmp/.keep ADDED
File without changes
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: clean-this-dirty-string
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Dmitry Sadovnikov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-08-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description:
56
+ email:
57
+ - sadovnikov.js@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile.lock
64
+ - README.md
65
+ - clean-this-dirty-string.gemspec
66
+ - gemfile
67
+ - lib/clean_this_dirty_string.rb
68
+ - most_popular_chars.txt
69
+ - tmp/.keep
70
+ homepage: https://github.com/DmitrySadovnikov/clean-this-dirty-string
71
+ licenses: []
72
+ metadata: {}
73
+ post_install_message:
74
+ rdoc_options: []
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ requirements: []
88
+ rubyforge_project:
89
+ rubygems_version: 2.7.7
90
+ signing_key:
91
+ specification_version: 4
92
+ summary: It cleans your dirty string
93
+ test_files: []