name_abbr 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/README.md +30 -0
- data/Rakefile +2 -0
- data/lib/name_abbr.rb +10 -2
- data/lib/name_abbr/version.rb +3 -0
- data/license.txt +21 -0
- data/name_abbr.gemspec +27 -0
- metadata +85 -7
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MTRkYjhmOWE5OTk0Y2I3MGU4MTE2OTYyYWVlNjc0MmJiMzMxNjdhOA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 99549dbec4f7b2a3a654a1fa8bf3a74ff2e78452
|
4
|
+
data.tar.gz: aa2f27309a1c55c229c719628d51fe1512585ab6
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NDM5NmY5MzExZmVjZjczZDQ3YjRhM2U1NDYwZmIwYzM2OTczZWUzNWJiNmMw
|
11
|
-
YzdjMjE5ODhhY2JlYjMyY2ZlMmE5ZGM3MmQ5M2Y3ZjRkOGRkOTY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YTY2NTY0NTM3YTBhMDhjYTkwZTRmMGY2YzA2NGMyYmY3NWQ4ZGYxMjY5Mjdk
|
14
|
-
NWI1MWVlOWYzYzNmNmQwN2VkZmZjMjYxZjYyNzg4MzEzYWU0YTQ5ZTdlNTRh
|
15
|
-
ODZmNzcwMGVlMzZjNTA1MjAxMDVlMjQwYTE0ZTdjZWYxOGZjN2I=
|
6
|
+
metadata.gz: 62230efc5ca8d2d2d8b108db32b5966baf43b7859a3ade7ff358271cc1f597f2aeddf35a9e1f2248f48b80a272eddea4037f83dbc11a11eada4738e5f52dd004
|
7
|
+
data.tar.gz: 2a961aa0ccc36647fba7b30b0d920a0a7fef3ecdd0daa90a18273d424901a80e112a5a106a393d9d7a367c0cb45e836c15e63554a8c8955f1d0cdff29977be81
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/name_abbr.svg)](http://badge.fury.io/rb/name_abbr)
|
2
|
+
|
3
|
+
name_abbr
|
4
|
+
=========
|
5
|
+
|
6
|
+
A simple gem to take a full name and abbreviate it like "John D."
|
7
|
+
|
8
|
+
## installation
|
9
|
+
|
10
|
+
`gem install name_abbr`
|
11
|
+
|
12
|
+
## usage
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
irb(main):001:0> require 'name_abbr'
|
16
|
+
=> true
|
17
|
+
irb(main):002:0> NameAbbr.abbr_name('john', 'doe')
|
18
|
+
=> "john d."
|
19
|
+
irb(main):003:0> NameAbbr.abbr_name('john', '')
|
20
|
+
=> "john"
|
21
|
+
irb(main):004:0> NameAbbr.abbr_name('john', nil)
|
22
|
+
=> "john"
|
23
|
+
irb(main):010:0> NameAbbr.abbr_full_name('hey')
|
24
|
+
=> "hey"
|
25
|
+
irb(main):011:0> NameAbbr.abbr_full_name('john doe')
|
26
|
+
=> "john d."
|
27
|
+
irb(main):012:0> NameAbbr.abbr_full_name('john doe')
|
28
|
+
=> "john d."
|
29
|
+
```
|
30
|
+
|
data/Rakefile
ADDED
data/lib/name_abbr.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
module NameAbbr
|
2
2
|
def self.abbr_name(first_name, last_name)
|
3
3
|
first_name = normalize(first_name)
|
4
4
|
last_name = normalize(last_name)
|
@@ -23,6 +23,14 @@ class NameAbbr
|
|
23
23
|
|
24
24
|
private
|
25
25
|
def self.normalize(input)
|
26
|
-
input.
|
26
|
+
return nil if input.nil?
|
27
|
+
|
28
|
+
ret = input.to_s.strip.split(" ").map(&:capitalize).join(" ")
|
29
|
+
|
30
|
+
ret.gsub!(/\-(.)/) do |match|
|
31
|
+
"-#{ match[-1].upcase }"
|
32
|
+
end
|
33
|
+
|
34
|
+
ret
|
27
35
|
end
|
28
36
|
end
|
data/license.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) [year] [fullname]
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/name_abbr.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'name_abbr/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "name_abbr"
|
8
|
+
spec.version = NameAbbr::VERSION
|
9
|
+
spec.authors = ["Miles Matthias"]
|
10
|
+
spec.email = ["miles.matthias@gmail.com"]
|
11
|
+
spec.summary = %q{Full Name Abbreviator}
|
12
|
+
spec.description = %q{Abbreviate full names like John D.}
|
13
|
+
spec.homepage = "https://github.com/milesmatthias/name_abbr"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "pry", "~> 0.9.0"
|
24
|
+
spec.add_development_dependency "pry-remote"
|
25
|
+
spec.add_development_dependency "pry-nav"
|
26
|
+
|
27
|
+
end
|
metadata
CHANGED
@@ -1,22 +1,100 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: name_abbr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Matthias
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2015-04-14 00:00:00.000000000 Z
|
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.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.9.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.9.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry-remote
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry-nav
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
13
83
|
description: Abbreviate full names like John D.
|
14
|
-
email:
|
84
|
+
email:
|
85
|
+
- miles.matthias@gmail.com
|
15
86
|
executables: []
|
16
87
|
extensions: []
|
17
88
|
extra_rdoc_files: []
|
18
89
|
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- Gemfile
|
92
|
+
- README.md
|
93
|
+
- Rakefile
|
19
94
|
- lib/name_abbr.rb
|
95
|
+
- lib/name_abbr/version.rb
|
96
|
+
- license.txt
|
97
|
+
- name_abbr.gemspec
|
20
98
|
homepage: https://github.com/milesmatthias/name_abbr
|
21
99
|
licenses:
|
22
100
|
- MIT
|
@@ -27,17 +105,17 @@ require_paths:
|
|
27
105
|
- lib
|
28
106
|
required_ruby_version: !ruby/object:Gem::Requirement
|
29
107
|
requirements:
|
30
|
-
- -
|
108
|
+
- - ">="
|
31
109
|
- !ruby/object:Gem::Version
|
32
110
|
version: '0'
|
33
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
112
|
requirements:
|
35
|
-
- -
|
113
|
+
- - ">="
|
36
114
|
- !ruby/object:Gem::Version
|
37
115
|
version: '0'
|
38
116
|
requirements: []
|
39
117
|
rubyforge_project:
|
40
|
-
rubygems_version: 2.
|
118
|
+
rubygems_version: 2.2.2
|
41
119
|
signing_key:
|
42
120
|
specification_version: 4
|
43
121
|
summary: Full Name Abbreviator
|