embossing_name 0.1.7 → 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/Gemfile +1 -0
- data/README.md +10 -9
- data/bin/console +1 -1
- data/embossing_name.gemspec +3 -3
- data/lib/{embossing_name.rb → embossing.rb} +11 -13
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 123337d72448cb7ed002bfee46757b11ca64b3d6
|
|
4
|
+
data.tar.gz: 013c2108a4678d7299f0d7864ad968c1ac7616bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 48bd6d0df0ac363e143d78295424aadc2f2c24ab8c5b54875fc01ef3341bee55c5ca5cbc293fc8b2a2e68448abec02d07ab354796ee4fb70c4f9f7b7ea792391
|
|
7
|
+
data.tar.gz: e6aba7fe4637f0d3ee843032e28d88e517225a25e8d84f81ffb8031321fc7ac373a53643427f848254d1437f6c3fda66dbcb16c42a70e6371050c645f18f0843
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -23,17 +23,18 @@ Or install it yourself as:
|
|
|
23
23
|
## Usage
|
|
24
24
|
|
|
25
25
|
Full format:
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
```ruby
|
|
27
|
+
Embossing::Name.normalize_name_to_embossing('Wickaninnish Muscowequan Aputsiaq Goyathlay') #=> "WICKANINNISH M A GOY"
|
|
28
|
+
```
|
|
28
29
|
|
|
29
30
|
Only reducing the name:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
```ruby
|
|
32
|
+
Embossing::Name.reduct_name('Nanook Quidel Kaneonuskatew Qillaq') #=> "Nanook Q K Qillaq"
|
|
33
|
+
```
|
|
33
34
|
Only removing the accents:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
```ruby
|
|
36
|
+
Embossing::Name.remove_accents('Nanóók Quídél Kaneonuskatew Qillaq') #=> "Nanook Quidel Kaneonuskatew Qillaq"
|
|
37
|
+
```
|
|
37
38
|
|
|
38
39
|
## Development
|
|
39
40
|
|
|
@@ -43,7 +44,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
|
43
44
|
|
|
44
45
|
## Contributing
|
|
45
46
|
|
|
46
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
|
47
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/jinascimento/embossing_name. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
47
48
|
|
|
48
49
|
|
|
49
50
|
## License
|
data/bin/console
CHANGED
data/embossing_name.gemspec
CHANGED
|
@@ -5,13 +5,13 @@ require 'embossing_name/version'
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "embossing_name"
|
|
8
|
-
spec.version = "0.
|
|
8
|
+
spec.version = "0.2.0"
|
|
9
9
|
spec.authors = ["Jhonatan I. Nascimento"]
|
|
10
|
-
spec.email = ["jhonatan-nascimento94@hotmail.com
|
|
10
|
+
spec.email = ["jhonatan-nascimento94@hotmail.com"]
|
|
11
11
|
|
|
12
12
|
spec.summary = "A gem of embossing of card"
|
|
13
13
|
spec.description = "This gem is used for embossing of card, also have methods of normalization of name"
|
|
14
|
-
spec.homepage = "https://github.com/
|
|
14
|
+
spec.homepage = "https://github.com/jinascimento"
|
|
15
15
|
spec.license = "MIT"
|
|
16
16
|
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
module
|
|
2
|
-
class
|
|
3
|
-
|
|
1
|
+
module Embossing
|
|
2
|
+
class Name
|
|
3
|
+
require 'active_support/inflector'
|
|
4
4
|
|
|
5
5
|
class << self
|
|
6
|
-
|
|
7
6
|
def normalize_name_to_embossing(full_name, size_name = 19)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
embossing_name = remove_accents(full_name)
|
|
8
|
+
embossing_name = remove_abreviate(embossing_name)
|
|
9
|
+
embossing_name = reduct_name(embossing_name, size_name)
|
|
10
|
+
embossing_name = embossing_name.upcase[0..size_name]
|
|
12
11
|
end
|
|
13
12
|
|
|
14
13
|
def reduct_name(full_name, size_name = 19)
|
|
15
14
|
if full_name.size > size_name
|
|
16
15
|
full_name = full_name.split
|
|
17
|
-
reduce_name =
|
|
18
|
-
full_name.each_with_index { |n, i| reduce_name += (i == 0 || i == full_name.size-1 ? " #{n}" : " #{n[0]}") }
|
|
16
|
+
reduce_name = ''
|
|
17
|
+
full_name.each_with_index { |n, i| reduce_name += (i == 0 || i == full_name.size - 1 ? " #{n}" : " #{n[0]}") }
|
|
19
18
|
reduce_name[1...reduce_name.size]
|
|
20
19
|
else
|
|
21
20
|
full_name
|
|
@@ -24,15 +23,14 @@ module EmbossingName
|
|
|
24
23
|
|
|
25
24
|
def remove_abreviate(name_card)
|
|
26
25
|
name_card = name_card.split
|
|
27
|
-
abreviate = [
|
|
26
|
+
abreviate = %w[da do das dos]
|
|
28
27
|
abreviate.each { |ab| name_card.delete(ab) }
|
|
29
|
-
name_card.join(
|
|
28
|
+
name_card.join(' ')
|
|
30
29
|
end
|
|
31
30
|
|
|
32
31
|
def remove_accents(full_name)
|
|
33
32
|
ActiveSupport::Inflector.transliterate(full_name)
|
|
34
33
|
end
|
|
35
|
-
|
|
36
34
|
end
|
|
37
35
|
end
|
|
38
36
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: embossing_name
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jhonatan I. Nascimento
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-12-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -55,7 +55,7 @@ dependencies:
|
|
|
55
55
|
description: This gem is used for embossing of card, also have methods of normalization
|
|
56
56
|
of name
|
|
57
57
|
email:
|
|
58
|
-
- jhonatan-nascimento94@hotmail.com
|
|
58
|
+
- jhonatan-nascimento94@hotmail.com
|
|
59
59
|
executables: []
|
|
60
60
|
extensions: []
|
|
61
61
|
extra_rdoc_files: []
|
|
@@ -71,9 +71,9 @@ files:
|
|
|
71
71
|
- bin/console
|
|
72
72
|
- bin/setup
|
|
73
73
|
- embossing_name.gemspec
|
|
74
|
-
- lib/
|
|
74
|
+
- lib/embossing.rb
|
|
75
75
|
- lib/embossing_name/version.rb
|
|
76
|
-
homepage: https://github.com/
|
|
76
|
+
homepage: https://github.com/jinascimento
|
|
77
77
|
licenses:
|
|
78
78
|
- MIT
|
|
79
79
|
metadata: {}
|
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
93
93
|
version: '0'
|
|
94
94
|
requirements: []
|
|
95
95
|
rubyforge_project:
|
|
96
|
-
rubygems_version: 2.6.
|
|
96
|
+
rubygems_version: 2.6.14
|
|
97
97
|
signing_key:
|
|
98
98
|
specification_version: 4
|
|
99
99
|
summary: A gem of embossing of card
|