name_of_person 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +16 -1
- data/lib/name_of_person.rb +1 -0
- data/lib/name_of_person/loaders/active_model_has_person_name.rb +1 -7
- data/lib/name_of_person/loaders/active_record_has_person_name.rb +1 -6
- data/lib/name_of_person/person_name.rb +1 -1
- data/name_of_person.gemspec +1 -1
- data/test/has_person_name_test.rb +2 -1
- data/test/person_name_test.rb +15 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 361510fe7cb6b267e3a9d5e2b58e62b17a1a1330fb8ec833c5f6b9b744ad3811
|
4
|
+
data.tar.gz: a520d4f0283d4333607491548e03aa7509921008210385ba67c594bb6b47ad58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a828efd10ce8133325a60ca4bdbc643b3736f84c9acc1e8738d612223ffaef082e425b9478c1cb152197db7a0128754cfbc493783832859bcb1f544a4c0f6ce
|
7
|
+
data.tar.gz: c98b44e5420cadd80d7a2d997a1493e99ebed9b81f73bc2d6b2302ff9e47dca6d072b9a59804417f1acd1a5b44da243fd8c176f8f4d35ad27a5c7aa0669cc2f5
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -28,10 +28,25 @@ name = NameOfPerson::PersonName.full("David Heinemeier Hansson")
|
|
28
28
|
name.first # => "David"
|
29
29
|
```
|
30
30
|
|
31
|
+
## Installation
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
# Gemfile
|
35
|
+
gem 'name_of_person'
|
36
|
+
```
|
37
|
+
|
38
|
+
If you are using this outside of Rails, make sure `ActiveRecord` and/or `ActiveModel` are manually required.
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
require 'active_record'
|
42
|
+
# and/or
|
43
|
+
require 'active_model'
|
44
|
+
```
|
45
|
+
|
31
46
|
## Maintenance Expectations
|
32
47
|
|
33
48
|
This library is an extraction from Basecamp that's been sufficient in almost unaltered form for over 10 years. While contributions are always welcome, do not expect a lot of feature evolution beyond the basics. Feel free to fork this library if you'd like to add large upgrades like titulations or different accommodations for other languages.
|
34
49
|
|
35
50
|
## License
|
36
51
|
|
37
|
-
Name of Person is released under the [MIT License](https://opensource.org/licenses/MIT).
|
52
|
+
Name of Person is released under the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/name_of_person.rb
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
|
2
|
-
require 'active_model'
|
3
|
-
require 'name_of_person/has_person_name'
|
4
|
-
|
5
|
-
require 'active_model/model'
|
1
|
+
if defined?(ActiveModel)
|
6
2
|
ActiveModel::Model.send :include, NameOfPerson::HasPersonName
|
7
|
-
rescue LoadError
|
8
|
-
# Active Model won't be auto-configured with has_person_name
|
9
3
|
end
|
data/name_of_person.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'name_of_person'
|
3
|
-
s.version = '1.1.
|
3
|
+
s.version = '1.1.1'
|
4
4
|
s.authors = 'David Heinemeier Hansson'
|
5
5
|
s.email = 'david@basecamp.com'
|
6
6
|
s.summary = 'Presenting names of people in full, familiar, abbreviated, and initialized forms (but without titulation etc)'
|
data/test/person_name_test.rb
CHANGED
@@ -71,6 +71,21 @@ class PersonNameTest < ActiveSupport::TestCase
|
|
71
71
|
assert_equal 'D', name.initials
|
72
72
|
end
|
73
73
|
|
74
|
+
test "initials skip anything inside parenthesis" do
|
75
|
+
name = PersonName.full('Conor Muirhead (Basecamp)')
|
76
|
+
assert_equal 'CM', name.initials
|
77
|
+
end
|
78
|
+
|
79
|
+
test "initials skip anything inside brackets" do
|
80
|
+
name = PersonName.full('Conor Muirhead [Basecamp]')
|
81
|
+
assert_equal 'CM', name.initials
|
82
|
+
end
|
83
|
+
|
84
|
+
test "initials skip non-word characters" do
|
85
|
+
name = PersonName.full('Conor Muirhead !')
|
86
|
+
assert_equal 'CM', name.initials
|
87
|
+
end
|
88
|
+
|
74
89
|
test "from full name" do
|
75
90
|
name = PersonName.full('Will St. Clair')
|
76
91
|
assert_equal 'Will', name.first
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: name_of_person
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -92,8 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
|
-
|
96
|
-
rubygems_version: 2.7.6
|
95
|
+
rubygems_version: 3.0.3
|
97
96
|
signing_key:
|
98
97
|
specification_version: 4
|
99
98
|
summary: Presenting names of people in full, familiar, abbreviated, and initialized
|