frnames 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/frnames/caser.rb +43 -0
- data/lib/frnames.rb +3 -0
- metadata +49 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1d05fdd8bfb8133171b28404bcc780832f19e772
|
4
|
+
data.tar.gz: e29ba50ef418bbb4d7275d2130e818e1b8c3dd42
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a344331c5352e4ac3f7775b729eef08541b928700603667871dc26602332a323a58ae60cc1a260c12e989d61d389b6cc6598abce4cb2777f0ae141198792a65c
|
7
|
+
data.tar.gz: 76f6e21f383c6b662517af7478f30c964b3274fa86430c5aa3ab0587f23b520c9742053c9f2951ec5d97c256f85708a5ddcba22acc43c1606bf0957f130e8f45
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
|
3
|
+
module StringHelper
|
4
|
+
|
5
|
+
# == Returns
|
6
|
+
# Good and valid french town name
|
7
|
+
def frnameup
|
8
|
+
town = self
|
9
|
+
#remove non chars
|
10
|
+
town.gsub!(/[^[[:alpha:]]']+/, '-')
|
11
|
+
#remove useless things
|
12
|
+
town.strip!
|
13
|
+
#capitalize
|
14
|
+
town = town.gsub(/\w+/, &:capitalize)
|
15
|
+
#EXCEPTION LE MANS
|
16
|
+
return "Le Mans" if town == "Le-Mans"
|
17
|
+
#Remove preposition
|
18
|
+
town.gsub(/\A(le|la|les|l'|de|des|d') */, '')
|
19
|
+
#replace the A, En, ...
|
20
|
+
town.gsub!('Le-', 'le-')
|
21
|
+
town.gsub!('La-', 'la-')
|
22
|
+
town.gsub!('Les-', 'les-')
|
23
|
+
town.gsub!('L\'', 'l\'')
|
24
|
+
town.gsub!('De-', 'de-')
|
25
|
+
town.gsub!('Des-', 'des-')
|
26
|
+
town.gsub!('D\'', 'd\'')
|
27
|
+
town.gsub!('En-', 'en-')
|
28
|
+
town.gsub!('Sous-', 'sous-')
|
29
|
+
town.gsub!('Sur-', 'sur-')
|
30
|
+
town.gsub!('Lès-', 'lès-')
|
31
|
+
town.gsub!('Près-', 'près-')
|
32
|
+
town.gsub!('Aux-', 'aux-')
|
33
|
+
town.gsub!('Au-', 'au-')
|
34
|
+
town.gsub!('Devant-', 'devant-')
|
35
|
+
#return final value
|
36
|
+
return town
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
class String
|
42
|
+
prepend StringHelper
|
43
|
+
end
|
data/lib/frnames.rb
ADDED
metadata
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: frnames
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- poulet_a
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-25 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A gem to create good names for the fkngs France's towns
|
14
|
+
email:
|
15
|
+
- poulet_a@epitech.eu
|
16
|
+
- - lib/frnames.rb
|
17
|
+
- lib/frnames/caser.rb
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- lib/frnames.rb
|
23
|
+
- lib/frnames/caser.rb
|
24
|
+
homepage: https://gitlab.com/Sopheny/frnames
|
25
|
+
licenses:
|
26
|
+
- GNU/GPLv3
|
27
|
+
metadata: {}
|
28
|
+
post_install_message:
|
29
|
+
rdoc_options: []
|
30
|
+
require_paths:
|
31
|
+
- lib
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
requirements: []
|
43
|
+
rubyforge_project:
|
44
|
+
rubygems_version: 2.4.1
|
45
|
+
signing_key:
|
46
|
+
specification_version: 4
|
47
|
+
summary: A gem to create good names ini
|
48
|
+
test_files: []
|
49
|
+
has_rdoc:
|