hypocorism 0.0.1 → 0.0.2

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 CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NzliMzEyN2VjN2NmODU5ODZhNjMyMDE4NmY4ZmNhNzU3NWY4ODVhNA==
5
- data.tar.gz: !binary |-
6
- NmZmZGI1ZjFlMTIxNmVkM2M0YWFmZTMwYTQ4MTliY2Y3YmUwMDU2NQ==
2
+ SHA1:
3
+ metadata.gz: 00a9de26e1727f2c951ce8b1b1483b1cfb1d53ad
4
+ data.tar.gz: d8439b250a867a6b63fb07ae39d208a9bc73b995
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YTJiNTYyNzkyOTFkNmViMjVkMTZhMTZkMDcyYjMwOTdjN2FjYTdkNzczNzA5
10
- YTRhZmYyMmJiMmZlYTEwNDFhMDAzYjA3Y2YxNzM5YWZjNTYzMDI1MTZlMWZk
11
- YWJmM2Y2NDkxNGEyOGU0OTcyZjcwM2Y3YzZhNTllNjNkMTIwOWE=
12
- data.tar.gz: !binary |-
13
- YTk4ODRiMGQyYWZmMWY1YzA2NTAwOTg5ZWM5ZGRjY2E2MzA4NjJiMDNmZmYx
14
- OTNjNGJkN2M5NzU5MGEwNzVlNDgwODliODg5YjI1OTJmMTMwMzg3ZTkzMDI1
15
- ZGVkODZjNDk4YWFlZDZkYjI2NzZiMjUzNzBlNjQzNmM2NjgxNTU=
6
+ metadata.gz: 27f2f6b588da46b9f85cb81f39d5b8104528611707943964ecc1b1ae38027de4cc3dd99a42cc42015b4830e563c1713f48c3dc41c59a9e6f08a146d119fc0595
7
+ data.tar.gz: a389b98bc25f738b3b37879b5ed3146ea0cca46a68f535b869b30c29dff857470a70455ba4701ffa8c2017295671a9bc883fa6fbf3e5d4e020088d0bb6745f88
data/README.md CHANGED
@@ -35,6 +35,6 @@ Will return:
35
35
 
36
36
  Source data
37
37
  -----------
38
- This tool use data from this source:
38
+ This tool uses data from this source:
39
39
 
40
40
  http://cpansearch.perl.org/src/BRIANL/Lingua-EN-Nickname-1.17/nicknames.txt
@@ -1,6 +1,6 @@
1
1
  module Hypocorism
2
2
 
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
 
5
5
  class << self
6
6
  def source_path
@@ -16,7 +16,7 @@ module Hypocorism
16
16
  end
17
17
 
18
18
  def match(name, another)
19
- variations_of(name).include?(another)
19
+ variations_of(name.downcase).include?(another.downcase)
20
20
  end
21
21
 
22
22
  def variations_of(name)
@@ -27,7 +27,8 @@ module Hypocorism
27
27
  def source_with_e_varients
28
28
  source.collect! do |line|
29
29
  line.collect!{|m| /(.*)E$/ =~ m ? e_varients_of($1) : m}
30
- line.flatten
30
+ line.flatten!
31
+ line.collect! &:downcase!
31
32
  end
32
33
  end
33
34
 
@@ -18,6 +18,22 @@ class HypocorismTest < MiniTest::Unit::TestCase
18
18
  end
19
19
  end
20
20
 
21
+ def test_match_case_insensive
22
+ {
23
+ 'robert' => true,
24
+ 'BOB' => true,
25
+ 'bobby' => true,
26
+ 'Rob' => true,
27
+ 'dave' => false,
28
+ 'HARRY' => false,
29
+ 'Mary' => false
30
+ }.each do |name, result|
31
+ assert_equal result, Hypocorism.match('Robert', name), "#{name} should#{' not' unless result} match Robert"
32
+ assert_equal result, Hypocorism.match('robert', name), "#{name} should#{' not' unless result} match robert"
33
+ assert_equal result, Hypocorism.match('ROBERT', name), "#{name} should#{' not' unless result} match ROBERT"
34
+ end
35
+ end
36
+
21
37
  def test_variations_of
22
38
  name_data = Hypocorism.names.first
23
39
  assert_equal name_data, Hypocorism.variations_of(name_data.first)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hypocorism
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Nichols
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-08 00:00:00.000000000 Z
11
+ date: 2017-03-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A tool for matching English first names with their shortened version.
14
14
  email: rob@undervale.co.uk
@@ -16,10 +16,10 @@ executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
- - lib/hypocorism.rb
20
19
  - MIT-LICENSE
21
20
  - README.md
22
21
  - data/nicknames.txt
22
+ - lib/hypocorism.rb
23
23
  - test/hypocorism_test.rb
24
24
  homepage: https://github.com/reggieb/hypocorism
25
25
  licenses:
@@ -31,17 +31,17 @@ require_paths:
31
31
  - lib
32
32
  required_ruby_version: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - ! '>='
34
+ - - ">="
35
35
  - !ruby/object:Gem::Version
36
36
  version: '0'
37
37
  required_rubygems_version: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ! '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  requirements: []
43
43
  rubyforge_project:
44
- rubygems_version: 2.1.10
44
+ rubygems_version: 2.5.1
45
45
  signing_key:
46
46
  specification_version: 4
47
47
  summary: Allows Rob to be matched with Robert, Bobby and Bob