string_ext 0.1.0 → 0.1.1

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
- SHA1:
3
- metadata.gz: 1377790bed7d927442839175faeaa52afb276e6c
4
- data.tar.gz: 22e7a843305669affe875c741c21a52b362bd020
2
+ SHA256:
3
+ metadata.gz: a7fb5733ea6c14ceaa83b8751270240e8da0d93b1a39f44927bb18606bab1571
4
+ data.tar.gz: 6fac464db03f3a0eec1b6be3cfeeb892322f7a228ab646509e2f8d1b91174b55
5
5
  SHA512:
6
- metadata.gz: 1965612dc6f573f994bf62ae8a18ec657ff708f9fd745387811c9ba1a3654d8910e5ac890719061082bec1392fb4e44ce4f75b0afeb8068a43ef6b0792c35732
7
- data.tar.gz: 28f50bc86906bcb8c94fc0ae0355c6d5ebfb774cd1003ba11405116a22a3ee08cc0cd2ae6dbfb0ed4e86eff5a00d8c6302f6cdcc367b1352cb62923b3ceea36e
6
+ metadata.gz: e36d88767d2d7a07b3e866152b3717bca0994abbcf831740ace8f248e13789e5112c7a2b24514d417536aca25ee09d80f96d23962cfd9b33659f391be492b000
7
+ data.tar.gz: a7df7e3fa6d1055cfa96cbd0db5384e25aa03083582f09625a7bb4c42dea8ff2f93c63d16ff1b137e4c62da726978576dfa3c5e8b49019c255ca195fe1a0c373
data/.travis.yml CHANGED
@@ -1,11 +1,20 @@
1
1
  language: ruby
2
+
2
3
  rvm:
3
- - 1.9.3
4
4
  - 2.0
5
5
  - 2.1
6
6
  - 2.2
7
- - 2.3.0
8
- - 2.4.0
9
- - jruby
10
- before_install:
11
- - gem install bundler
7
+ - 2.3
8
+ - 2.4
9
+ - 2.5
10
+ - 2.6
11
+ - 2.7
12
+ - jruby-9.2.9.0
13
+ - ruby-head
14
+ - jruby-head
15
+
16
+ matrix:
17
+ fast_finish: true
18
+ allow_failures:
19
+ - rvm: ruby-head
20
+ - rvm: jruby-head
data/README.md CHANGED
@@ -4,7 +4,6 @@
4
4
  [![Build Status](https://travis-ci.org/gabynaiman/string_ext.svg?branch=master)](https://travis-ci.org/gabynaiman/string_ext)
5
5
  [![Coverage Status](https://coveralls.io/repos/github/gabynaiman/string_ext/badge.svg?branch=master)](https://coveralls.io/github/gabynaiman/string_ext?branch=master)
6
6
  [![Code Climate](https://codeclimate.com/github/gabynaiman/string_ext.svg)](https://codeclimate.com/github/gabynaiman/string_ext)
7
- [![Dependency Status](https://gemnasium.com/gabynaiman/string_ext.svg)](https://gemnasium.com/gabynaiman/string_ext)
8
7
 
9
8
  String utils for accented and special chars
10
9
 
data/lib/string_ext.rb CHANGED
@@ -31,6 +31,11 @@ module StringExt
31
31
  upcase: 'ÑÇ' + ACCENTS.values.map { |a| a[:upcase] }.join
32
32
  }
33
33
 
34
+ UNACCENT_REPLACEMENTS = ACCENTS.each_with_object({accented: '', unaccented: ''}) do |(char, cases), replacements|
35
+ replacements[:accented] += cases[:upcase] + cases[:downcase]
36
+ replacements[:unaccented] += (char * cases[:upcase].size) + (char.downcase * cases[:downcase].size)
37
+ end
38
+
34
39
  extend self
35
40
 
36
41
  def upcase(string)
@@ -42,9 +47,7 @@ module StringExt
42
47
  end
43
48
 
44
49
  def unaccented(string)
45
- ACCENTS.inject(string) do |s, (char, cases)|
46
- s.tr(cases[:upcase], char).tr(cases[:downcase], char.downcase)
47
- end
50
+ string.tr(UNACCENT_REPLACEMENTS[:accented], UNACCENT_REPLACEMENTS[:unaccented])
48
51
  end
49
52
 
50
53
  end
@@ -1,3 +1,3 @@
1
1
  module StringExt
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
data/string_ext.gemspec CHANGED
@@ -18,18 +18,11 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_development_dependency 'bundler', '~> 1.12'
22
- spec.add_development_dependency 'rake', '~> 11.0'
23
- spec.add_development_dependency 'minitest', '~> 5.0'
21
+ spec.add_development_dependency 'rake', '~> 12.0'
22
+ spec.add_development_dependency 'minitest', '~> 5.0', '< 5.11'
24
23
  spec.add_development_dependency 'minitest-colorin', '~> 0.1'
25
24
  spec.add_development_dependency 'minitest-line', '~> 0.6'
26
25
  spec.add_development_dependency 'simplecov', '~> 0.12'
27
26
  spec.add_development_dependency 'coveralls', '~> 0.8'
28
27
  spec.add_development_dependency 'pry-nav', '~> 0.2'
29
-
30
- if RUBY_VERSION < '2'
31
- spec.add_development_dependency 'term-ansicolor', '~> 1.3.0'
32
- spec.add_development_dependency 'tins', '~> 1.6.0'
33
- spec.add_development_dependency 'json', '~> 1.8'
34
- end
35
28
  end
metadata CHANGED
@@ -1,43 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: string_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Naiman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-05 00:00:00.000000000 Z
11
+ date: 2021-05-03 00:00:00.000000000 Z
12
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: '1.12'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.12'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - "~>"
32
18
  - !ruby/object:Gem::Version
33
- version: '11.0'
19
+ version: '12.0'
34
20
  type: :development
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - "~>"
39
25
  - !ruby/object:Gem::Version
40
- version: '11.0'
26
+ version: '12.0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: minitest
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -45,6 +31,9 @@ dependencies:
45
31
  - - "~>"
46
32
  - !ruby/object:Gem::Version
47
33
  version: '5.0'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '5.11'
48
37
  type: :development
49
38
  prerelease: false
50
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,6 +41,9 @@ dependencies:
52
41
  - - "~>"
53
42
  - !ruby/object:Gem::Version
54
43
  version: '5.0'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '5.11'
55
47
  - !ruby/object:Gem::Dependency
56
48
  name: minitest-colorin
57
49
  requirement: !ruby/object:Gem::Requirement
@@ -163,8 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
155
  - !ruby/object:Gem::Version
164
156
  version: '0'
165
157
  requirements: []
166
- rubyforge_project:
167
- rubygems_version: 2.6.8
158
+ rubygems_version: 3.0.6
168
159
  signing_key:
169
160
  specification_version: 4
170
161
  summary: String utils for accented and special chars