user_info_normalizer 0.3.0 → 0.3.1
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 +4 -4
- data/Gemfile +8 -7
- data/Gemfile.lock +26 -47
- data/lib/user_info_normalizer.rb +32 -3
- data/lib/user_info_normalizer/configuration.rb +1 -1
- data/lib/user_info_normalizer/version.rb +1 -1
- data/user_info_normalizer.gemspec +3 -3
- metadata +3 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54d1cd15318fb1ef23c97aa8612464fef070c7e7
|
4
|
+
data.tar.gz: 9f771c6705b05053a96ce1f7f9d58384c840397e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a9cc84625683ba43bc49b59607660a7bde026f98971be3bb2fbe7023d1488bacb4ccc845df6818241e0b53c8eb69e57d6339079386651fc97f48a9c485b159c
|
7
|
+
data.tar.gz: e63d7bff903852eb46e1dc454a383458797d4efb9fa00a65a7c5964d730b62a24ccf08827f7ec58f294de5f98e923912f6181f6218e4079e5191bf00012d7913
|
data/Gemfile
CHANGED
@@ -4,10 +4,11 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in user_info_normalizer.gemspec
|
6
6
|
gemspec
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
#gem 'rspec-rails'
|
8
|
+
# group :development do
|
9
|
+
# gem 'byebug'
|
10
|
+
# gem 'pry'
|
11
|
+
# gem 'pry-rails'
|
12
|
+
# gem 'pry-byebug'
|
13
|
+
# gem 'rspec-rails'
|
14
|
+
# end
|
data/Gemfile.lock
CHANGED
@@ -1,37 +1,35 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
user_info_normalizer (0.3.
|
4
|
+
user_info_normalizer (0.3.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
actionpack (5.2.
|
10
|
-
actionview (= 5.2.
|
11
|
-
activesupport (= 5.2.
|
9
|
+
actionpack (5.2.1)
|
10
|
+
actionview (= 5.2.1)
|
11
|
+
activesupport (= 5.2.1)
|
12
12
|
rack (~> 2.0)
|
13
13
|
rack-test (>= 0.6.3)
|
14
14
|
rails-dom-testing (~> 2.0)
|
15
15
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
16
|
-
actionview (5.2.
|
17
|
-
activesupport (= 5.2.
|
16
|
+
actionview (5.2.1)
|
17
|
+
activesupport (= 5.2.1)
|
18
18
|
builder (~> 3.1)
|
19
19
|
erubi (~> 1.4)
|
20
20
|
rails-dom-testing (~> 2.0)
|
21
21
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
22
|
-
activesupport (5.2.
|
22
|
+
activesupport (5.2.1)
|
23
23
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
24
24
|
i18n (>= 0.7, < 2)
|
25
25
|
minitest (~> 5.1)
|
26
26
|
tzinfo (~> 1.1)
|
27
27
|
builder (3.2.3)
|
28
|
-
byebug (10.0.2)
|
29
|
-
coderay (1.1.2)
|
30
28
|
concurrent-ruby (1.0.5)
|
31
29
|
crass (1.0.4)
|
32
30
|
diff-lcs (1.3)
|
33
31
|
erubi (1.7.1)
|
34
|
-
i18n (1.0
|
32
|
+
i18n (1.1.0)
|
35
33
|
concurrent-ruby (~> 1.0)
|
36
34
|
loofah (2.2.2)
|
37
35
|
crass (~> 1.0.2)
|
@@ -41,50 +39,38 @@ GEM
|
|
41
39
|
minitest (5.11.3)
|
42
40
|
nokogiri (1.8.4)
|
43
41
|
mini_portile2 (~> 2.3.0)
|
44
|
-
pry (0.11.3)
|
45
|
-
coderay (~> 1.1.0)
|
46
|
-
method_source (~> 0.9.0)
|
47
|
-
pry-byebug (3.6.0)
|
48
|
-
byebug (~> 10.0)
|
49
|
-
pry (~> 0.10)
|
50
|
-
pry-rails (0.3.6)
|
51
|
-
pry (>= 0.10.4)
|
52
42
|
rack (2.0.5)
|
53
|
-
rack-test (1.
|
43
|
+
rack-test (1.1.0)
|
54
44
|
rack (>= 1.0, < 3)
|
55
45
|
rails-dom-testing (2.0.3)
|
56
46
|
activesupport (>= 4.2.0)
|
57
47
|
nokogiri (>= 1.6)
|
58
48
|
rails-html-sanitizer (1.0.4)
|
59
49
|
loofah (~> 2.2, >= 2.2.2)
|
60
|
-
railties (5.2.
|
61
|
-
actionpack (= 5.2.
|
62
|
-
activesupport (= 5.2.
|
50
|
+
railties (5.2.1)
|
51
|
+
actionpack (= 5.2.1)
|
52
|
+
activesupport (= 5.2.1)
|
63
53
|
method_source
|
64
54
|
rake (>= 0.8.7)
|
65
|
-
thor (>= 0.
|
66
|
-
rake (
|
67
|
-
rspec (3.
|
68
|
-
rspec-
|
69
|
-
|
70
|
-
rspec-mocks (~> 3.7.0)
|
71
|
-
rspec-core (3.7.1)
|
72
|
-
rspec-support (~> 3.7.0)
|
73
|
-
rspec-expectations (3.7.0)
|
55
|
+
thor (>= 0.19.0, < 2.0)
|
56
|
+
rake (12.3.1)
|
57
|
+
rspec-core (3.8.0)
|
58
|
+
rspec-support (~> 3.8.0)
|
59
|
+
rspec-expectations (3.8.1)
|
74
60
|
diff-lcs (>= 1.2.0, < 2.0)
|
75
|
-
rspec-support (~> 3.
|
76
|
-
rspec-mocks (3.
|
61
|
+
rspec-support (~> 3.8.0)
|
62
|
+
rspec-mocks (3.8.0)
|
77
63
|
diff-lcs (>= 1.2.0, < 2.0)
|
78
|
-
rspec-support (~> 3.
|
79
|
-
rspec-rails (3.
|
64
|
+
rspec-support (~> 3.8.0)
|
65
|
+
rspec-rails (3.8.0)
|
80
66
|
actionpack (>= 3.0)
|
81
67
|
activesupport (>= 3.0)
|
82
68
|
railties (>= 3.0)
|
83
|
-
rspec-core (~> 3.
|
84
|
-
rspec-expectations (~> 3.
|
85
|
-
rspec-mocks (~> 3.
|
86
|
-
rspec-support (~> 3.
|
87
|
-
rspec-support (3.
|
69
|
+
rspec-core (~> 3.8.0)
|
70
|
+
rspec-expectations (~> 3.8.0)
|
71
|
+
rspec-mocks (~> 3.8.0)
|
72
|
+
rspec-support (~> 3.8.0)
|
73
|
+
rspec-support (3.8.0)
|
88
74
|
thor (0.20.0)
|
89
75
|
thread_safe (0.3.6)
|
90
76
|
tzinfo (1.2.5)
|
@@ -94,13 +80,6 @@ PLATFORMS
|
|
94
80
|
ruby
|
95
81
|
|
96
82
|
DEPENDENCIES
|
97
|
-
bundler (~> 1.16)
|
98
|
-
byebug
|
99
|
-
pry
|
100
|
-
pry-byebug
|
101
|
-
pry-rails
|
102
|
-
rake (~> 10.0)
|
103
|
-
rspec (~> 3.0)
|
104
83
|
rspec-rails
|
105
84
|
user_info_normalizer!
|
106
85
|
|
data/lib/user_info_normalizer.rb
CHANGED
@@ -29,25 +29,54 @@ module UserInfoNormalizer
|
|
29
29
|
|
30
30
|
def normalize_address
|
31
31
|
# 数字の前後で長音などはありえないのでハイフンに直す, 数字も全角に
|
32
|
-
self.tr('0-9', '0-9')
|
32
|
+
self.tr('0-9', '0-9')
|
33
|
+
.gsub(/([0-9])(#{UserInfoNormalizer::HYPHEN_REGEXP})+/, '\1-')
|
34
|
+
.squeeze('-')
|
35
|
+
.strip
|
33
36
|
end
|
34
37
|
|
35
38
|
def normalize_zip_code
|
36
39
|
case UserInfoNormalizer::configuration.zip_code_form
|
37
40
|
when '123-4567'
|
38
|
-
self.tr('0-9', '0-9')
|
41
|
+
str = self.tr('0-9', '0-9')
|
39
42
|
.gsub(/#{UserInfoNormalizer::HYPHEN_REGEXP}/, '-')
|
40
43
|
.squeeze('-')
|
41
44
|
.delete("^0-9|-")
|
45
|
+
if str.length == 7 && str =~ /\A[0-9]+\z/
|
46
|
+
# 数字7文字だった場合
|
47
|
+
str.insert(3, '-')
|
48
|
+
end
|
49
|
+
str
|
42
50
|
else
|
43
51
|
# default: '123-4567'
|
44
|
-
self.tr('0-9', '0-9')
|
52
|
+
str = self.tr('0-9', '0-9')
|
45
53
|
.gsub(/#{UserInfoNormalizer::HYPHEN_REGEXP}/, '-')
|
46
54
|
.squeeze('-')
|
47
55
|
.delete("^0-9|-")
|
56
|
+
if str.length == 7 && str =~ /\A[0-9]+\z/
|
57
|
+
# 全角数字7文字だった場合
|
58
|
+
str.insert(3, '-')
|
59
|
+
end
|
60
|
+
str
|
48
61
|
end.strip
|
49
62
|
end
|
50
63
|
|
64
|
+
def normalize_tel
|
65
|
+
case UserInfoNormalizer::configuration.tel_form
|
66
|
+
when '012-3456-7890'
|
67
|
+
self.tr('0-9', '0-9').tr(' ', ' ')
|
68
|
+
.gsub(/#{UserInfoNormalizer::HYPHEN_REGEXP}/, '-')
|
69
|
+
.squeeze('-')
|
70
|
+
.delete("^0-9|-| ").strip.tr(' ', '-')
|
71
|
+
else
|
72
|
+
# default: '123-4567'
|
73
|
+
self.tr('0-9', '0-9').tr(' ', ' ')
|
74
|
+
.gsub(/#{UserInfoNormalizer::HYPHEN_REGEXP}/, '-')
|
75
|
+
.squeeze('-')
|
76
|
+
.delete("^0-9|-| ").strip.tr(' ', '-')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
51
80
|
def to_hiragana
|
52
81
|
NKF.nkf('-w --hiragana', self)
|
53
82
|
end
|
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
33
33
|
spec.require_paths = ["lib"]
|
34
34
|
|
35
|
-
spec.add_development_dependency "bundler", "~> 1.16"
|
36
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
37
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
35
|
+
# spec.add_development_dependency "bundler", "~> 1.16"
|
36
|
+
# spec.add_development_dependency "rake", "~> 10.0"
|
37
|
+
# spec.add_development_dependency "rspec", "~> 3.0"
|
38
38
|
end
|
metadata
CHANGED
@@ -1,57 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: user_info_normalizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hirata masato
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
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.16'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.16'
|
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: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.0'
|
11
|
+
date: 2018-08-13 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
55
13
|
description: normalize user's information form such as zip_code, address...
|
56
14
|
email:
|
57
15
|
- hirata@piano.or.jp
|