full_name 0.0.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/full_name.rb +26 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d922e261990297dd4fb0d185e0ff433cafb2898
|
4
|
+
data.tar.gz: 047931817f810b2619966608d669cb3a2c1b6f9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3a6821683a2b84766169e7cf2622b8bcfb7885d65c7e1195ce7c7bf43c8ec7b19507a207292725d2b98f67580be0a354110c4de5b55e5465206d6af9279c025
|
7
|
+
data.tar.gz: 7d6e510e0dd9d69c46844a1ad7b9b89839b36f7296170f6a4c7fc58a8cd1ffea0cbbe0891f53806641b3ddf6ce5d2f98c2e92453d9c059e29a37b6923a155d0d
|
data/lib/full_name.rb
CHANGED
@@ -1,6 +1,29 @@
|
|
1
|
-
|
2
|
-
def
|
3
|
-
|
1
|
+
module FullName
|
2
|
+
def full_name locale = :en
|
3
|
+
if locale != :en and locale != :fr
|
4
|
+
return full_name(:en)
|
5
|
+
end
|
6
|
+
|
7
|
+
if first_name and first_name.size > 0
|
8
|
+
if last_name and last_name.size > 0
|
9
|
+
case locale
|
10
|
+
when :en then
|
11
|
+
full_name = [first_name.capitalize, last_name.capitalize].join(' ')
|
12
|
+
when :fr then
|
13
|
+
full_name = "#{last_name.upcase}, #{first_name.capitalize}"
|
14
|
+
end
|
15
|
+
|
16
|
+
else
|
17
|
+
full_name = first_name.capitalize
|
18
|
+
end
|
19
|
+
else
|
20
|
+
case locale
|
21
|
+
when :en then
|
22
|
+
full_name = last_name.capitalize
|
23
|
+
when :fr then
|
24
|
+
full_name = last_name.upcase
|
25
|
+
end
|
26
|
+
end
|
4
27
|
end
|
5
28
|
end
|
6
29
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: full_name
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benoit Gantaume
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Adds full_name method for classes that provide a first_name and a last_name!
|
14
14
|
email: benoit@agilidee.com
|
@@ -17,7 +17,7 @@ extensions: []
|
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
19
|
- lib/full_name.rb
|
20
|
-
homepage:
|
20
|
+
homepage: https://github.com/AGILiDEE/full_name
|
21
21
|
licenses:
|
22
22
|
- MIT
|
23
23
|
metadata: {}
|