jpmobile 7.0.1 → 7.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3292578aadf3276cb4304224f8b4563fe25244e03b7fa337d2ba7dd3a542f3f1
4
- data.tar.gz: 6f472acb84fad3decceaed599afa71397e5dd92d851a0300bb03d595b9f48aef
3
+ metadata.gz: 1353f6341c914dfadbe29cdf617506304701dafdbdc826e21a7339b8963d7934
4
+ data.tar.gz: 6007f9958265cae1eb8e73fdf50fb308b6d5ce086452d6986025244d52e525bb
5
5
  SHA512:
6
- metadata.gz: 0bcc18a422c95df268feb18ddbe7e61d9d94f9481cbacda09edce99990b2cb2f3e909b319a96b411aeeff7e7b995dcc2a794406b80f3c1d2292d991c0bbd72f3
7
- data.tar.gz: 802f4a65b7ba13537ec9c548a109eeb13205363ce0afc1bb4f13c0fd228663f33dfc128cf8615f2ca3f6ba6f8f0a3a7a33f05841984d6ada7eb648afe9801bcd
6
+ metadata.gz: b5623190d12407d9f5f6bd8348faf7fa2f81b206dc773d13898acc2a1da354fac16916564883c56692246fc4ebdcd8f40dc7ddd9f39e1d9974bb22abe5bf5d33
7
+ data.tar.gz: e873923cfcfcfdd0a80211a1197269117f920c905a886ed22cb0fbcadeeb8d6a3065d7dafde6839a053aff7107fff08e4d913f80c7a4fc948314a670f20588ee
data/.circleci/config.yml CHANGED
@@ -5,7 +5,7 @@ jobs:
5
5
  test-job:
6
6
  working_directory: ~/jpmobile
7
7
  docker:
8
- - image: cimg/ruby:3.0-browsers
8
+ - image: cimg/ruby:3.1-browsers
9
9
  environment:
10
10
  BUNDLE_JOBS: 3
11
11
  BUNDLE_RETRY: 3
data/.rubocop.yml CHANGED
@@ -3,7 +3,7 @@ require: rubocop-performance
3
3
  inherit_from: './.onkcop-config.yml'
4
4
 
5
5
  AllCops:
6
- TargetRubyVersion: 3.0
6
+ TargetRubyVersion: 2.7
7
7
  Exclude:
8
8
  - 'tmp/**/*'
9
9
  - 'bin/*'
@@ -194,3 +194,106 @@ Style/OptionalBooleanParameter:
194
194
  Metrics/ParameterLists:
195
195
  Exclude:
196
196
  - 'lib/jpmobile/path_set.rb'
197
+
198
+ Gemspec/DateAssignment: # new in 1.10
199
+ Enabled: true
200
+ Gemspec/RequireMFA: # new in 1.23
201
+ Enabled: true
202
+ Layout/LineEndStringConcatenationIndentation: # new in 1.18
203
+ Enabled: true
204
+ Lint/AmbiguousOperatorPrecedence: # new in 1.21
205
+ Enabled: true
206
+ Lint/AmbiguousRange: # new in 1.19
207
+ Enabled: true
208
+ Lint/DeprecatedConstants: # new in 1.8
209
+ Enabled: true
210
+ Lint/EmptyInPattern: # new in 1.16
211
+ Enabled: true
212
+ Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
213
+ Enabled: true
214
+ Lint/LambdaWithoutLiteralBlock: # new in 1.8
215
+ Enabled: true
216
+ Lint/NumberedParameterAssignment: # new in 1.9
217
+ Enabled: true
218
+ Lint/OrAssignmentToConstant: # new in 1.9
219
+ Enabled: true
220
+ Lint/RedundantDirGlobSort: # new in 1.8
221
+ Enabled: true
222
+ Lint/RequireRelativeSelfPath: # new in 1.22
223
+ Enabled: true
224
+ Lint/SymbolConversion: # new in 1.9
225
+ Enabled: true
226
+ Lint/TripleQuotes: # new in 1.9
227
+ Enabled: true
228
+ Lint/UselessRuby2Keywords: # new in 1.23
229
+ Enabled: true
230
+ Naming/BlockForwarding: # new in 1.24
231
+ Enabled: true
232
+ Security/IoMethods: # new in 1.22
233
+ Enabled: true
234
+ Style/EndlessMethod: # new in 1.8
235
+ Enabled: true
236
+ Style/FileRead: # new in 1.24
237
+ Enabled: true
238
+ Style/FileWrite: # new in 1.24
239
+ Enabled: true
240
+ Style/HashConversion: # new in 1.10
241
+ Enabled: true
242
+ Style/IfWithBooleanLiteralBranches: # new in 1.9
243
+ Enabled: true
244
+ Style/InPatternThen: # new in 1.16
245
+ Enabled: true
246
+ Style/MapToHash: # new in 1.24
247
+ Enabled: true
248
+ Style/MultilineInPatternThen: # new in 1.16
249
+ Enabled: true
250
+ Style/NumberedParameters: # new in 1.22
251
+ Enabled: true
252
+ Style/NumberedParametersLimit: # new in 1.22
253
+ Enabled: true
254
+ Style/OpenStructUse: # new in 1.23
255
+ Enabled: true
256
+ Style/QuotedSymbols: # new in 1.16
257
+ Enabled: true
258
+ Style/RedundantSelfAssignmentBranch: # new in 1.19
259
+ Enabled: true
260
+ Style/SelectByRegexp: # new in 1.22
261
+ Enabled: true
262
+ Style/StringChars: # new in 1.12
263
+ Enabled: true
264
+ Performance/AncestorsInclude: # new in 1.7
265
+ Enabled: true
266
+ Performance/BigDecimalWithNumericArgument: # new in 1.7
267
+ Enabled: true
268
+ Performance/BlockGivenWithExplicitBlock: # new in 1.9
269
+ Enabled: true
270
+ Performance/CollectionLiteralInLoop: # new in 1.8
271
+ Enabled: true
272
+ Performance/ConcurrentMonotonicTime: # new in 1.12
273
+ Enabled: true
274
+ Performance/ConstantRegexp: # new in 1.9
275
+ Enabled: true
276
+ Performance/MapCompact: # new in 1.11
277
+ Enabled: true
278
+ Performance/MethodObjectAsBlock: # new in 1.9
279
+ Enabled: true
280
+ Performance/RedundantEqualityComparisonBlock: # new in 1.10
281
+ Enabled: true
282
+ Performance/RedundantSortBlock: # new in 1.7
283
+ Enabled: true
284
+ Performance/RedundantSplitRegexpArgument: # new in 1.10
285
+ Enabled: true
286
+ Performance/RedundantStringChars: # new in 1.7
287
+ Enabled: true
288
+ Performance/ReverseFirst: # new in 1.7
289
+ Enabled: true
290
+ Performance/SortReverse: # new in 1.7
291
+ Enabled: true
292
+ Performance/Squeeze: # new in 1.7
293
+ Enabled: true
294
+ Performance/StringIdentifierArgument: # new in 1.13
295
+ Enabled: true
296
+ Performance/StringInclude: # new in 1.7
297
+ Enabled: false
298
+ Performance/Sum: # new in 1.8
299
+ Enabled: true
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.0.3
1
+ 3.1.2
data/Gemfile.lock CHANGED
@@ -9,67 +9,67 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (7.0.1)
13
- actionpack (= 7.0.1)
14
- activesupport (= 7.0.1)
12
+ actioncable (7.0.3)
13
+ actionpack (= 7.0.3)
14
+ activesupport (= 7.0.3)
15
15
  nio4r (~> 2.0)
16
16
  websocket-driver (>= 0.6.1)
17
- actionmailbox (7.0.1)
18
- actionpack (= 7.0.1)
19
- activejob (= 7.0.1)
20
- activerecord (= 7.0.1)
21
- activestorage (= 7.0.1)
22
- activesupport (= 7.0.1)
17
+ actionmailbox (7.0.3)
18
+ actionpack (= 7.0.3)
19
+ activejob (= 7.0.3)
20
+ activerecord (= 7.0.3)
21
+ activestorage (= 7.0.3)
22
+ activesupport (= 7.0.3)
23
23
  mail (>= 2.7.1)
24
24
  net-imap
25
25
  net-pop
26
26
  net-smtp
27
- actionmailer (7.0.1)
28
- actionpack (= 7.0.1)
29
- actionview (= 7.0.1)
30
- activejob (= 7.0.1)
31
- activesupport (= 7.0.1)
27
+ actionmailer (7.0.3)
28
+ actionpack (= 7.0.3)
29
+ actionview (= 7.0.3)
30
+ activejob (= 7.0.3)
31
+ activesupport (= 7.0.3)
32
32
  mail (~> 2.5, >= 2.5.4)
33
33
  net-imap
34
34
  net-pop
35
35
  net-smtp
36
36
  rails-dom-testing (~> 2.0)
37
- actionpack (7.0.1)
38
- actionview (= 7.0.1)
39
- activesupport (= 7.0.1)
37
+ actionpack (7.0.3)
38
+ actionview (= 7.0.3)
39
+ activesupport (= 7.0.3)
40
40
  rack (~> 2.0, >= 2.2.0)
41
41
  rack-test (>= 0.6.3)
42
42
  rails-dom-testing (~> 2.0)
43
43
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
44
- actiontext (7.0.1)
45
- actionpack (= 7.0.1)
46
- activerecord (= 7.0.1)
47
- activestorage (= 7.0.1)
48
- activesupport (= 7.0.1)
44
+ actiontext (7.0.3)
45
+ actionpack (= 7.0.3)
46
+ activerecord (= 7.0.3)
47
+ activestorage (= 7.0.3)
48
+ activesupport (= 7.0.3)
49
49
  globalid (>= 0.6.0)
50
50
  nokogiri (>= 1.8.5)
51
- actionview (7.0.1)
52
- activesupport (= 7.0.1)
51
+ actionview (7.0.3)
52
+ activesupport (= 7.0.3)
53
53
  builder (~> 3.1)
54
54
  erubi (~> 1.4)
55
55
  rails-dom-testing (~> 2.0)
56
56
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
57
- activejob (7.0.1)
58
- activesupport (= 7.0.1)
57
+ activejob (7.0.3)
58
+ activesupport (= 7.0.3)
59
59
  globalid (>= 0.3.6)
60
- activemodel (7.0.1)
61
- activesupport (= 7.0.1)
62
- activerecord (7.0.1)
63
- activemodel (= 7.0.1)
64
- activesupport (= 7.0.1)
65
- activestorage (7.0.1)
66
- actionpack (= 7.0.1)
67
- activejob (= 7.0.1)
68
- activerecord (= 7.0.1)
69
- activesupport (= 7.0.1)
60
+ activemodel (7.0.3)
61
+ activesupport (= 7.0.3)
62
+ activerecord (7.0.3)
63
+ activemodel (= 7.0.3)
64
+ activesupport (= 7.0.3)
65
+ activestorage (7.0.3)
66
+ actionpack (= 7.0.3)
67
+ activejob (= 7.0.3)
68
+ activerecord (= 7.0.3)
69
+ activesupport (= 7.0.3)
70
70
  marcel (~> 1.0)
71
71
  mini_mime (>= 1.1.0)
72
- activesupport (7.0.1)
72
+ activesupport (7.0.3)
73
73
  concurrent-ruby (~> 1.0, >= 1.0.2)
74
74
  i18n (>= 1.6, < 2)
75
75
  minitest (>= 5.1)
@@ -77,21 +77,20 @@ GEM
77
77
  ast (2.4.2)
78
78
  builder (3.2.4)
79
79
  coderay (1.1.3)
80
- concurrent-ruby (1.1.9)
80
+ concurrent-ruby (1.1.10)
81
81
  crass (1.0.6)
82
82
  diff-lcs (1.5.0)
83
83
  digest (3.1.0)
84
84
  erubi (1.10.0)
85
85
  geokit (1.13.1)
86
- git (1.10.2)
86
+ git (1.11.0)
87
87
  rchardet (~> 1.8)
88
88
  globalid (1.0.0)
89
89
  activesupport (>= 5.0)
90
90
  hpricot (0.8.6)
91
- i18n (1.8.11)
91
+ i18n (1.10.0)
92
92
  concurrent-ruby (~> 1.0)
93
- io-wait (0.2.1)
94
- loofah (2.13.0)
93
+ loofah (2.18.0)
95
94
  crass (~> 1.0.2)
96
95
  nokogiri (>= 1.5.9)
97
96
  mail (2.7.1)
@@ -108,50 +107,49 @@ GEM
108
107
  digest
109
108
  net-protocol
110
109
  timeout
111
- net-protocol (0.1.2)
112
- io-wait
110
+ net-protocol (0.1.3)
113
111
  timeout
114
112
  net-smtp (0.3.1)
115
113
  digest
116
114
  net-protocol
117
115
  timeout
118
116
  nio4r (2.5.8)
119
- nokogiri (1.13.0-arm64-darwin)
117
+ nokogiri (1.13.6-arm64-darwin)
120
118
  racc (~> 1.4)
121
- nokogiri (1.13.0-x86_64-linux)
119
+ nokogiri (1.13.6-x86_64-linux)
122
120
  racc (~> 1.4)
123
- parallel (1.21.0)
124
- parser (3.1.0.0)
121
+ parallel (1.22.1)
122
+ parser (3.1.2.0)
125
123
  ast (~> 2.4.1)
126
124
  pry (0.14.1)
127
125
  coderay (~> 1.1)
128
126
  method_source (~> 1.0)
129
127
  racc (1.6.0)
130
- rack (2.2.3)
128
+ rack (2.2.3.1)
131
129
  rack-test (1.1.0)
132
130
  rack (>= 1.0, < 3)
133
- rails (7.0.1)
134
- actioncable (= 7.0.1)
135
- actionmailbox (= 7.0.1)
136
- actionmailer (= 7.0.1)
137
- actionpack (= 7.0.1)
138
- actiontext (= 7.0.1)
139
- actionview (= 7.0.1)
140
- activejob (= 7.0.1)
141
- activemodel (= 7.0.1)
142
- activerecord (= 7.0.1)
143
- activestorage (= 7.0.1)
144
- activesupport (= 7.0.1)
131
+ rails (7.0.3)
132
+ actioncable (= 7.0.3)
133
+ actionmailbox (= 7.0.3)
134
+ actionmailer (= 7.0.3)
135
+ actionpack (= 7.0.3)
136
+ actiontext (= 7.0.3)
137
+ actionview (= 7.0.3)
138
+ activejob (= 7.0.3)
139
+ activemodel (= 7.0.3)
140
+ activerecord (= 7.0.3)
141
+ activestorage (= 7.0.3)
142
+ activesupport (= 7.0.3)
145
143
  bundler (>= 1.15.0)
146
- railties (= 7.0.1)
144
+ railties (= 7.0.3)
147
145
  rails-dom-testing (2.0.3)
148
146
  activesupport (>= 4.2.0)
149
147
  nokogiri (>= 1.6)
150
148
  rails-html-sanitizer (1.4.2)
151
149
  loofah (~> 2.3)
152
- railties (7.0.1)
153
- actionpack (= 7.0.1)
154
- activesupport (= 7.0.1)
150
+ railties (7.0.3)
151
+ actionpack (= 7.0.3)
152
+ activesupport (= 7.0.3)
155
153
  method_source
156
154
  rake (>= 12.2)
157
155
  thor (~> 1.0)
@@ -159,24 +157,24 @@ GEM
159
157
  rainbow (3.1.1)
160
158
  rake (13.0.6)
161
159
  rchardet (1.8.0)
162
- regexp_parser (2.2.0)
160
+ regexp_parser (2.5.0)
163
161
  rexml (3.2.5)
164
- rspec (3.10.0)
165
- rspec-core (~> 3.10.0)
166
- rspec-expectations (~> 3.10.0)
167
- rspec-mocks (~> 3.10.0)
168
- rspec-core (3.10.1)
169
- rspec-support (~> 3.10.0)
170
- rspec-expectations (3.10.1)
162
+ rspec (3.11.0)
163
+ rspec-core (~> 3.11.0)
164
+ rspec-expectations (~> 3.11.0)
165
+ rspec-mocks (~> 3.11.0)
166
+ rspec-core (3.11.0)
167
+ rspec-support (~> 3.11.0)
168
+ rspec-expectations (3.11.0)
171
169
  diff-lcs (>= 1.2.0, < 2.0)
172
- rspec-support (~> 3.10.0)
170
+ rspec-support (~> 3.11.0)
173
171
  rspec-its (1.3.0)
174
172
  rspec-core (>= 3.0.0)
175
173
  rspec-expectations (>= 3.0.0)
176
- rspec-mocks (3.10.2)
174
+ rspec-mocks (3.11.1)
177
175
  diff-lcs (>= 1.2.0, < 2.0)
178
- rspec-support (~> 3.10.0)
179
- rspec-rails (5.0.2)
176
+ rspec-support (~> 3.11.0)
177
+ rspec-rails (5.1.2)
180
178
  actionpack (>= 5.2)
181
179
  activesupport (>= 5.2)
182
180
  railties (>= 5.2)
@@ -184,45 +182,46 @@ GEM
184
182
  rspec-expectations (~> 3.10)
185
183
  rspec-mocks (~> 3.10)
186
184
  rspec-support (~> 3.10)
187
- rspec-support (3.10.3)
188
- rubocop (1.24.1)
185
+ rspec-support (3.11.0)
186
+ rubocop (1.30.0)
189
187
  parallel (~> 1.10)
190
- parser (>= 3.0.0.0)
188
+ parser (>= 3.1.0.0)
191
189
  rainbow (>= 2.2.2, < 4.0)
192
190
  regexp_parser (>= 1.8, < 3.0)
193
- rexml
194
- rubocop-ast (>= 1.15.1, < 2.0)
191
+ rexml (>= 3.2.5, < 4.0)
192
+ rubocop-ast (>= 1.18.0, < 2.0)
195
193
  ruby-progressbar (~> 1.7)
196
194
  unicode-display_width (>= 1.4.0, < 3.0)
197
- rubocop-ast (1.15.1)
198
- parser (>= 3.0.1.1)
199
- rubocop-performance (1.13.1)
195
+ rubocop-ast (1.18.0)
196
+ parser (>= 3.1.1.0)
197
+ rubocop-performance (1.14.0)
200
198
  rubocop (>= 1.7.0, < 2.0)
201
199
  rubocop-ast (>= 0.4.0)
202
- rubocop-rails (2.13.1)
200
+ rubocop-rails (2.14.2)
203
201
  activesupport (>= 4.2.0)
204
202
  rack (>= 1.1)
205
203
  rubocop (>= 1.7.0, < 2.0)
206
- rubocop-rspec (2.7.0)
204
+ rubocop-rspec (2.11.1)
207
205
  rubocop (~> 1.19)
208
206
  ruby-progressbar (1.11.0)
209
207
  scanf (1.0.0)
210
208
  sqlite3 (1.4.2)
211
209
  sqlite3-ruby (1.3.3)
212
210
  sqlite3 (>= 1.3.3)
213
- strscan (3.0.1)
211
+ strscan (3.0.3)
214
212
  thor (1.2.1)
215
- timeout (0.2.0)
213
+ timeout (0.3.0)
216
214
  tzinfo (2.0.4)
217
215
  concurrent-ruby (~> 1.0)
218
216
  unicode-display_width (2.1.0)
219
217
  websocket-driver (0.7.5)
220
218
  websocket-extensions (>= 0.1.0)
221
219
  websocket-extensions (0.1.5)
222
- zeitwerk (2.5.3)
220
+ zeitwerk (2.5.4)
223
221
 
224
222
  PLATFORMS
225
223
  arm64-darwin-20
224
+ arm64-darwin-21
226
225
  x86_64-linux
227
226
 
228
227
  DEPENDENCIES
@@ -242,4 +241,4 @@ DEPENDENCIES
242
241
  sqlite3-ruby
243
242
 
244
243
  BUNDLED WITH
245
- 2.2.32
244
+ 2.3.15
data/README.md CHANGED
@@ -140,7 +140,7 @@ Rack::Request#mobile.position に位置情報が格納されます。
140
140
  @longuitude = request.mobile.position.lon
141
141
  ```
142
142
 
143
- #### [GeoKit](http://geokit.rubyforge.org) との連携
143
+ #### [GeoKit](https://github.com/geokit/geokit) との連携
144
144
 
145
145
  vendor/plugins/geokit以下にGeoKitがインストールされていると、Jpmobile::PositionにGeoKit::Mappableがincludeされる。したがって、
146
146
 
data/Rakefile CHANGED
@@ -21,7 +21,7 @@ namespace :test do
21
21
  'jpmobile-ipaddresses',
22
22
  'jpmobile-terminfo',
23
23
  ]
24
- github_prefix = 'git://github.com/jpmobile'
24
+ github_prefix = 'https://github.com/jpmobile'
25
25
  vendor_path = Pathname.new(Dir.pwd).join('vendor')
26
26
  FileUtils.mkdir_p(vendor_path)
27
27
 
data/jpmobile.gemspec CHANGED
@@ -30,4 +30,5 @@ Gem::Specification.new do |gem|
30
30
  gem.add_development_dependency 'rspec-its'
31
31
  gem.add_development_dependency 'rspec-rails'
32
32
  gem.add_development_dependency 'sqlite3-ruby'
33
+ gem.metadata['rubygems_mfa_required'] = 'true'
33
34
  end
@@ -19,11 +19,11 @@ module DatumConv
19
19
  l = l_deg * Deg2Rad
20
20
 
21
21
  e2 = f * (2 - f)
22
- n = a / Math.sqrt(1 - e2 * Math.sin(b)**2)
22
+ n = a / Math.sqrt(1 - (e2 * (Math.sin(b)**2)))
23
23
 
24
24
  x = (n + he) * Math.cos(b) * Math.cos(l)
25
25
  y = (n + he) * Math.cos(b) * Math.sin(l)
26
- z = (n * (1 - e2) + he) * Math.sin(b)
26
+ z = ((n * (1 - e2)) + he) * Math.sin(b)
27
27
  return x, y, z
28
28
  end
29
29
 
@@ -34,12 +34,12 @@ module DatumConv
34
34
  e2 = f * (2 - f)
35
35
  l = Math.atan2(y, x)
36
36
 
37
- p = Math.sqrt(x**2 + y**2)
38
- r = Math.sqrt(p**2 + z**2)
39
- u = Math.atan2(z * ((1 - f) + e2 * a / r), p)
40
- b = Math.atan2(z * (1 - f) + e2 * a * Math.sin(u)**3, (1 - f) * (p - e2 * a * Math.cos(u)**3))
37
+ p = Math.sqrt((x**2) + (y**2))
38
+ r = Math.sqrt((p**2) + (z**2))
39
+ u = Math.atan2(z * ((1 - f) + (e2 * a / r)), p)
40
+ b = Math.atan2((z * (1 - f)) + (e2 * a * (Math.sin(u)**3)), (1 - f) * (p - (e2 * a * (Math.cos(u)**3))))
41
41
 
42
- he = p * Math.cos(b) + z * Math.sin(b) - a * Math.sqrt(1 - e2 * Math.sin(b)**2)
42
+ he = (p * Math.cos(b)) + (z * Math.sin(b)) - (a * Math.sqrt(1 - (e2 * (Math.sin(b)**2))))
43
43
 
44
44
  b_deg = b / Deg2Rad
45
45
  l_deg = l / Deg2Rad
@@ -10,7 +10,7 @@ module Jpmobile
10
10
  def detect(email)
11
11
  Mobile.carriers.each do |const|
12
12
  c = Mobile.const_get(const)
13
- return c if c::MAIL_ADDRESS_REGEXP && email.match(/^#{c::MAIL_ADDRESS_REGEXP}$/)
13
+ return c if c::MAIL_ADDRESS_REGEXP && email.match(/^#{c::MAIL_ADDRESS_REGEXP}$/) # rubocop:disable Performance/ConstantRegexp
14
14
  end
15
15
  nil
16
16
  end
@@ -21,7 +21,7 @@ module Jpmobile
21
21
  c = Mobile.const_get(const)
22
22
  if c::MAIL_ADDRESS_REGEXP &&
23
23
  header.match(/(\S+@[A-Za-z0-9\-._]+)/) &&
24
- Regexp.last_match(1).match(/^#{c::MAIL_ADDRESS_REGEXP}$/)
24
+ Regexp.last_match(1).match(/^#{c::MAIL_ADDRESS_REGEXP}$/) # rubocop:disable Performance/ConstantRegexp
25
25
  return c
26
26
  end
27
27
  end
@@ -8,10 +8,10 @@ module Jpmobile
8
8
  begin
9
9
  expected_view_file = lookup_context.find_template(options[:template], options[:prefixes])
10
10
 
11
- _candidates = lookup_context.mobile.map {|variant|
11
+ _candidates = lookup_context.mobile.filter_map do |variant|
12
12
  target_template = options[:template] + '_' + variant
13
13
  expected_view_file.virtual_path.match(target_template)
14
- }.compact
14
+ end
15
15
 
16
16
  if _candidates.empty?
17
17
  lookup_context.mobile = []
@@ -42,6 +42,8 @@ module Jpmobile
42
42
  Regexp.escape('application/xhtml+xm'),
43
43
  )
44
44
 
45
+ CONVERT_TARGET_ELEMENTS = %w[submit reset button].freeze
46
+
45
47
  class << self
46
48
  def hankaku_format(str)
47
49
  replace_chars(str, zen_to_han_table)
@@ -149,7 +151,7 @@ module Jpmobile
149
151
  # textarea 以外のテキストなら content を変換
150
152
  element.content = filter(:hankaku, element.content)
151
153
  end
152
- elsif (element.node_name == 'input') && %w[submit reset button].include?(element['type'])
154
+ elsif (element.node_name == 'input') && CONVERT_TARGET_ELEMENTS.include?(element['type'])
153
155
  # テキスト以外でもボタンの value は変換
154
156
  element['value'] = filter(:hankaku, element['value'])
155
157
  elsif element.children.any?
data/lib/jpmobile/mail.rb CHANGED
@@ -55,7 +55,7 @@ module Mail
55
55
 
56
56
  def parse_message_with_jpmobile
57
57
  _crlf_raw_source = raw_source.encode(raw_source.encoding, universal_newline: true).encode!(raw_source.encoding, crlf_newline: true)
58
- header_part, body_part = _crlf_raw_source.lstrip.split(/#{CRLF}#{CRLF}|#{CRLF}#{WSP}*#{CRLF}(?!#{WSP})/m, 2)
58
+ header_part, body_part = _crlf_raw_source.lstrip.split(/#{CRLF}#{CRLF}|#{CRLF}#{WSP}*#{CRLF}(?!#{WSP})/mo, 2)
59
59
  # header_part, body_part = raw_source.lstrip.split(HEADER_SEPARATOR, 2)
60
60
 
61
61
  self.header = header_part
@@ -277,7 +277,7 @@ module Mail
277
277
  end
278
278
 
279
279
  def parse_message_with_jpmobile
280
- header_part, body_part = raw_source.split(/#{CRLF}#{WSP}*#{CRLF}/m, 2)
280
+ header_part, body_part = raw_source.split(/#{CRLF}#{WSP}*#{CRLF}/mo, 2)
281
281
 
282
282
  self.header = if header_part && header_part.match(HEADER_LINE)
283
283
  header_part
@@ -11,7 +11,7 @@ module Jpmobile
11
11
 
12
12
  def mail(headers = {}, &block)
13
13
  tos = headers[:to] || self.default_params[:to]
14
- tos = tos.split(/,/)
14
+ tos = tos.split(',')
15
15
 
16
16
  @mobile = if tos.size == 1
17
17
  # for mobile
@@ -242,7 +242,7 @@ module Jpmobile::Mobile
242
242
  end
243
243
 
244
244
  def ip_address_class
245
- Object.const_get("::Jpmobile::Mobile::IpAddresses::#{self.to_s.split(/::/).last}").new
245
+ Object.const_get("::Jpmobile::Mobile::IpAddresses::#{self.to_s.split("::").last}").new
246
246
  rescue
247
247
  nil
248
248
  end
@@ -6,6 +6,6 @@ module Jpmobile::Mobile
6
6
  include Jpmobile::Mobile::GoogleEmoticon
7
7
 
8
8
  # 対応するUser-Agentの正規表現
9
- USER_AGENT_REGEXP = /Android/
9
+ USER_AGENT_REGEXP = /Android/.freeze
10
10
  end
11
11
  end
@@ -6,15 +6,17 @@ module Jpmobile::Mobile
6
6
  class Au < AbstractMobile
7
7
  # 対応するUser-Agentの正規表現
8
8
  # User-Agent文字列中に "UP.Browser" を含むVodafoneの端末があるので注意が必要
9
- USER_AGENT_REGEXP = %r{^(?:KDDI|UP.Browser/.+?)-(.+?) }
9
+ USER_AGENT_REGEXP = %r{^(?:KDDI|UP.Browser/.+?)-(.+?) }.freeze
10
10
  # 対応するメールアドレスの正規表現
11
- MAIL_ADDRESS_REGEXP = /.+@ezweb\.ne\.jp/
11
+ MAIL_ADDRESS_REGEXP = /.+@ezweb\.ne\.jp/.freeze
12
12
  # 簡易位置情報取得に対応していないデバイスID
13
13
  # http://www.au.kddi.com/ezfactory/tec/spec/eznavi.html
14
14
  LOCATION_UNSUPPORTED_DEVICE_ID = %w[PT21 TS25 KCTE TST9 KCU1 SYT5 KCTD TST8 TST7 KCTC SYT4 KCTB KCTA TST6 KCT9 TST5 TST4 KCT8 SYT3 KCT7 MIT1 MAT3 KCT6 TST3 KCT5 KCT4 SYT2 MAT1 MAT2 TST2 KCT3 KCT2 KCT1 TST1 SYT1].freeze
15
15
  # GPS取得に対応していないデバイスID
16
16
  GPS_UNSUPPORTED_DEVICE_ID = %w[PT21 KC26 SN28 SN26 KC23 SA28 TS25 SA25 SA24 SN23 ST14 KC15 SN22 KC14 ST13 SN17 SY15 CA14 HI14 TS14 KC13 SN15 SN16 SY14 ST12 TS13 CA13 MA13 HI13 SN13 SY13 SN12 SN14 ST11 DN11 SY12 KCTE TST9 KCU1 SYT5 KCTD TST8 TST7 KCTC SYT4 KCTB KCTA TST6 KCT9 TST5 TST4 KCT8 SYT3 KCT7 MIT1 MAT3 KCT6 TST3 KCT5 KCT4 SYT2 MAT1 MAT2 TST2 KCT3 KCT2 KCT1 TST1 SYT1].freeze
17
17
 
18
+ TARGET_PARAMS = %w[ver datum unit lat lon alt time smaj smin vert majaa fm].freeze
19
+
18
20
  # EZ番号(サブスクライバID)があれば返す。無ければ +nil+ を返す。
19
21
  def subno
20
22
  @request.env['HTTP_X_UP_SUBNO']
@@ -27,7 +29,7 @@ module Jpmobile::Mobile
27
29
  return @__posotion = nil if params['lat'].nil? || params['lat'] == '' || params['lon'].nil? || params['lon'] == ''
28
30
 
29
31
  l = Jpmobile::Position.new
30
- l.options = params.select {|x, _| %w[ver datum unit lat lon alt time smaj smin vert majaa fm].include?(x) }
32
+ l.options = params.select {|x, _| TARGET_PARAMS.include?(x) }
31
33
  case params['unit']
32
34
  when '1'
33
35
  l.lat = params['lat'].to_f
@@ -83,11 +85,7 @@ module Jpmobile::Mobile
83
85
  'none'
84
86
  end
85
87
 
86
- if protocol.start_with?('https')
87
- false
88
- else
89
- true
90
- end
88
+ !protocol.start_with?('https')
91
89
  end
92
90
 
93
91
  # 文字コード変換
@@ -4,6 +4,6 @@ module Jpmobile::Mobile
4
4
  # ==BlackBerry
5
5
  class BlackBerry < SmartPhone
6
6
  # 対応するUser-Agentの正規表現
7
- USER_AGENT_REGEXP = /BlackBerry/
7
+ USER_AGENT_REGEXP = /BlackBerry/.freeze
8
8
  end
9
9
  end
@@ -4,7 +4,7 @@ module Jpmobile::Mobile
4
4
  # スーパクラスはWillcom。
5
5
  class Ddipocket < Willcom
6
6
  # 対応するUser-Agentの正規表現
7
- USER_AGENT_REGEXP = %r{^Mozilla/3.0\(DDIPOCKET}
7
+ USER_AGENT_REGEXP = %r{^Mozilla/3.0\(DDIPOCKET}.freeze
8
8
 
9
9
  MAIL_ADDRESS_REGEXP = nil # DdipocketはEmail判定だとWillcomと判定させたい
10
10
  end
@@ -4,9 +4,9 @@ module Jpmobile::Mobile
4
4
  # ==DoCoMo携帯電話
5
5
  class Docomo < AbstractMobile
6
6
  # 対応するUser-Agentの正規表現
7
- USER_AGENT_REGEXP = /^DoCoMo/
7
+ USER_AGENT_REGEXP = /^DoCoMo/.freeze
8
8
  # 対応するメールアドレスの正規表現
9
- MAIL_ADDRESS_REGEXP = /.+@docomo\.ne\.jp/
9
+ MAIL_ADDRESS_REGEXP = /.+@docomo\.ne\.jp/.freeze
10
10
  # メールのデフォルトのcharset
11
11
  MAIL_CHARSET = 'Shift_JIS'.freeze
12
12
  # テキスト部分の content-transfer-encoding
@@ -3,9 +3,9 @@
3
3
  module Jpmobile::Mobile
4
4
  # ==EMOBILE携帯電話
5
5
  class Emobile < AbstractMobile
6
- USER_AGENT_REGEXP = %r{^emobile/|^Mozilla/5.0 \(H11T; like Gecko; OpenBrowser\) NetFront/3.4$|^Mozilla/4.0 \(compatible; MSIE 6.0; Windows CE; IEMobile 7.7\) S11HT$}
6
+ USER_AGENT_REGEXP = %r{^emobile/|^Mozilla/5.0 \(H11T; like Gecko; OpenBrowser\) NetFront/3.4$|^Mozilla/4.0 \(compatible; MSIE 6.0; Windows CE; IEMobile 7.7\) S11HT$}.freeze
7
7
  # 対応するメールアドレスの正規表現
8
- MAIL_ADDRESS_REGEXP = /.+@emnet\.ne\.jp/
8
+ MAIL_ADDRESS_REGEXP = /.+@emnet\.ne\.jp/.freeze
9
9
  # EMnet対応端末から通知されるユニークなユーザIDを取得する。
10
10
  def em_uid
11
11
  @request.env['HTTP_X_EM_UID']
@@ -6,6 +6,6 @@ module Jpmobile::Mobile
6
6
  include Jpmobile::Mobile::UnicodeEmoticon
7
7
 
8
8
  # 対応するUser-Agentの正規表現
9
- USER_AGENT_REGEXP = /iPad/
9
+ USER_AGENT_REGEXP = /iPad/.freeze
10
10
  end
11
11
  end
@@ -6,6 +6,6 @@ module Jpmobile::Mobile
6
6
  include Jpmobile::Mobile::UnicodeEmoticon
7
7
 
8
8
  # 対応するUser-Agentの正規表現
9
- USER_AGENT_REGEXP = /iPhone/
9
+ USER_AGENT_REGEXP = /iPhone/.freeze
10
10
  end
11
11
  end
@@ -5,14 +5,16 @@ module Jpmobile::Mobile
5
5
  # Vodafoneのスーパクラス。
6
6
  class Softbank < AbstractMobile
7
7
  # 対応するuser-agentの正規表現
8
- USER_AGENT_REGEXP = /^(?:SoftBank|Semulator)/
8
+ USER_AGENT_REGEXP = /^(?:SoftBank|Semulator)/.freeze
9
9
  # 対応するメールアドレスの正規表現 ディズニーモバイル対応
10
- MAIL_ADDRESS_REGEXP = /.+@(?:softbank\.ne\.jp|disney\.ne\.jp)/
10
+ MAIL_ADDRESS_REGEXP = /.+@(?:softbank\.ne\.jp|disney\.ne\.jp)/.freeze
11
11
  # メールのデフォルトのcharset
12
12
  MAIL_CHARSET = 'Shift_JIS'.freeze
13
13
  # テキスト部分の content-transfer-encoding
14
14
  MAIL_CONTENT_TRANSFER_ENCODING = '8bit'.freeze
15
15
 
16
+ TARGET_PARAMS = ['pos', 'geo', 'x-acr'].freeze
17
+
16
18
  # 製造番号を返す。無ければ +nil+ を返す。
17
19
  def serial_number
18
20
  @request.env['HTTP_USER_AGENT'] =~ /SN(.+?) /
@@ -36,7 +38,7 @@ module Jpmobile::Mobile
36
38
  l = Jpmobile::Position.new
37
39
  l.lat = ((Regexp.last_match(1) == 'N') ? 1 : -1) * Jpmobile::Position.dms2deg(Regexp.last_match(2), Regexp.last_match(3), Regexp.last_match(4))
38
40
  l.lon = ((Regexp.last_match(5) == 'E') ? 1 : -1) * Jpmobile::Position.dms2deg(Regexp.last_match(6), Regexp.last_match(7), Regexp.last_match(8))
39
- l.options = params.select {|x, _| ['pos', 'geo', 'x-acr'].include?(x) }
41
+ l.options = params.select {|x, _| TARGET_PARAMS.include?(x) }
40
42
 
41
43
  @__position = l
42
44
  end
@@ -4,9 +4,9 @@ module Jpmobile::Mobile
4
4
  # スーパクラスはSoftbank。
5
5
  class Vodafone < Softbank
6
6
  # 対応するUser-Agentの正規表現
7
- USER_AGENT_REGEXP = /^(Vodafone|Vemulator)/
7
+ USER_AGENT_REGEXP = /^(Vodafone|Vemulator)/.freeze
8
8
  # 対応するメールアドレスの正規表現
9
- MAIL_ADDRESS_REGEXP = /.+@[dhtcrknsq]\.vodafone\.ne\.jp/
9
+ MAIL_ADDRESS_REGEXP = /.+@[dhtcrknsq]\.vodafone\.ne\.jp/.freeze
10
10
 
11
11
  # cookieに対応しているか?
12
12
  def supports_cookie?
@@ -4,9 +4,9 @@ module Jpmobile::Mobile
4
4
  # Ddipocketのスーパクラス。
5
5
  class Willcom < AbstractMobile
6
6
  # 対応するUser-Agentの正規表現
7
- USER_AGENT_REGEXP = %r{^Mozilla/3.0\(WILLCOM}
7
+ USER_AGENT_REGEXP = %r{^Mozilla/3.0\(WILLCOM}.freeze
8
8
  # 対応するメールアドレスの正規表現
9
- MAIL_ADDRESS_REGEXP = /.+@((.+\.)?pdx\.ne\.jp|willcom\.com)/
9
+ MAIL_ADDRESS_REGEXP = /.+@((.+\.)?pdx\.ne\.jp|willcom\.com)/.freeze
10
10
 
11
11
  # 位置情報があれば Position のインスタンスを返す。無ければ +nil+ を返す。
12
12
  def position
@@ -4,6 +4,6 @@ module Jpmobile::Mobile
4
4
  # ==WindowsPhone
5
5
  class WindowsPhone < SmartPhone
6
6
  # 対応するUser-Agentの正規表現
7
- USER_AGENT_REGEXP = /Windows Phone/
7
+ USER_AGENT_REGEXP = /Windows Phone/.freeze
8
8
  end
9
9
  end
@@ -10,7 +10,7 @@ end
10
10
  module Jpmobile
11
11
  # 位置情報
12
12
  class Position
13
- if Object.const_defined?('GeoKit')
13
+ if Object.const_defined?(:GeoKit)
14
14
  # GeoKitが読み込まれている場合はMappableにする
15
15
  include ::GeoKit::Mappable
16
16
  def self.acts_as_mappable
@@ -35,7 +35,7 @@ module Jpmobile
35
35
 
36
36
  # 度分秒を度に変換する。
37
37
  def self.dms2deg(d, m, s)
38
- d.to_i + m.to_i.to_f / 60 + s.to_f / 3600
38
+ d.to_i + (m.to_i.to_f / 60) + (s.to_f / 3600)
39
39
  end
40
40
 
41
41
  # 日本測地系から世界測地系に変換する。
@@ -19,8 +19,8 @@ module Jpmobile
19
19
  requested.formats_idx[@format],
20
20
  requested.locale_idx[@locale],
21
21
  requested.variants_idx[@variant],
22
- requested.handlers_idx[@handler],
23
22
  requested.mobile_idx[@mobile],
23
+ requested.handlers_idx[@handler],
24
24
  ]
25
25
  end
26
26
 
@@ -1,3 +1,3 @@
1
1
  module Jpmobile
2
- VERSION = '7.0.1'.freeze
2
+ VERSION = '7.0.2'.freeze
3
3
  end
@@ -84,12 +84,10 @@ namespace :test do
84
84
  unless skip
85
85
  # for cookie_only option
86
86
  config_path = File.join(rails_root, 'config', 'initializers', 'session_store.rb')
87
- File.open(config_path, 'w') do |file|
88
- file.write <<-SESSION_CONFIG
87
+ File.write(config_path, <<-SESSION_CONFIG)
89
88
  Rails.application.config.session_store :active_record_store, :key => '_session_id'
90
89
  Rails.application.config.session_options = { :cookie_only => false }
91
- SESSION_CONFIG
92
- end
90
+ SESSION_CONFIG
93
91
  end
94
92
 
95
93
  unless skip
@@ -14,7 +14,7 @@ describe 'decorated mails' do
14
14
  @mail.from = 'ちはやふる <info@jpmobile-rails.org>'
15
15
  @mail.to = 'むすめふさほせ <info+to@jpmobile-rails.org>'
16
16
 
17
- @photo = File.open(File.join(__dir__, 'email-fixtures/photo.jpg')).read
17
+ @photo = File.read(File.join(__dir__, 'email-fixtures/photo.jpg'))
18
18
  @mail.attachments.inline['photo.jpg'] = @photo
19
19
  @inline_url = @mail.attachments['photo.jpg'].url
20
20
  end
@@ -285,7 +285,7 @@ describe 'Jpmobile::Mail' do
285
285
  @mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
286
286
  @mail.mobile = @mobile
287
287
  @mail.to = 'むすめふさほせ <info+to@jpmobile-rails.org>'
288
- @photo = File.open(File.join(__dir__, 'email-fixtures/photo.jpg')).read
288
+ @photo = File.read(File.join(__dir__, 'email-fixtures/photo.jpg'))
289
289
  end
290
290
 
291
291
  it 'should encodes itself successfully' do
@@ -318,7 +318,7 @@ describe 'Jpmobile::Mail' do
318
318
  @mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
319
319
  @mail.mobile = @mobile
320
320
  @mail.to = 'むすめふさほせ <info+to@jpmobile-rails.org>'
321
- @photo = File.open(File.join(__dir__, 'email-fixtures/photo.jpg')).read
321
+ @photo = File.read(File.join(__dir__, 'email-fixtures/photo.jpg'))
322
322
  end
323
323
 
324
324
  it 'wave dash converting correctly' do
@@ -12,7 +12,7 @@ describe 'Jpmobile::Mail#receive' do
12
12
 
13
13
  describe 'PC mail' do
14
14
  before(:each) do
15
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/pc-mail-single.eml')).read)
15
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/pc-mail-single.eml')))
16
16
  end
17
17
 
18
18
  it 'subject should be parsed correctly' do
@@ -49,7 +49,7 @@ describe 'Jpmobile::Mail#receive' do
49
49
  describe 'multipart' do
50
50
  describe 'PC mail' do
51
51
  before(:each) do
52
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/pc-mail-multi.eml')).read)
52
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/pc-mail-multi.eml')))
53
53
  end
54
54
 
55
55
  it 'subject should be parsed correctly' do
@@ -68,7 +68,7 @@ describe 'Jpmobile::Mail#receive' do
68
68
 
69
69
  describe 'PC mail without subject' do
70
70
  before(:each) do
71
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/pc-mail-attached-without-subject.eml')).read)
71
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/pc-mail-attached-without-subject.eml')))
72
72
  end
73
73
 
74
74
  it 'body should be parsed correctly' do
@@ -84,7 +84,7 @@ describe 'Jpmobile::Mail#receive' do
84
84
  describe 'Docomo' do
85
85
  context 'with sjis decomail' do
86
86
  before(:each) do
87
- @mail = Mail.new(File.open(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/docomo-gmail-sjis.eml')).read)
87
+ @mail = Mail.new(File.read(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/docomo-gmail-sjis.eml')))
88
88
  end
89
89
 
90
90
  it 'subject should be parsed correctly' do
@@ -111,7 +111,7 @@ describe 'Jpmobile::Mail#receive' do
111
111
 
112
112
  context 'with jis decomail' do
113
113
  before(:each) do
114
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/docomo-decomail.eml')).read)
114
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/docomo-decomail.eml')))
115
115
  end
116
116
 
117
117
  it 'does not contain charset within multipart Content-Type' do
@@ -129,7 +129,7 @@ describe 'Jpmobile::Mail#receive' do
129
129
 
130
130
  describe 'Au' do
131
131
  before(:each) do
132
- @mail = Mail.new(File.open(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/au-decomail.eml')).read)
132
+ @mail = Mail.new(File.read(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/au-decomail.eml')))
133
133
  end
134
134
 
135
135
  it 'subject should be parsed correctly' do
@@ -151,7 +151,7 @@ describe 'Jpmobile::Mail#receive' do
151
151
  describe 'Softbank' do
152
152
  context 'Shift_JIS' do
153
153
  before(:each) do
154
- @mail = Mail.new(File.open(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/softbank-gmail-sjis.eml')).read)
154
+ @mail = Mail.new(File.read(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/softbank-gmail-sjis.eml')))
155
155
  end
156
156
 
157
157
  it 'subject should be parsed correctly' do
@@ -170,7 +170,7 @@ describe 'Jpmobile::Mail#receive' do
170
170
 
171
171
  context 'UTF-8' do
172
172
  before(:each) do
173
- @mail = Mail.new(File.open(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/softbank-gmail-utf8.eml')).read)
173
+ @mail = Mail.new(File.read(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/softbank-gmail-utf8.eml')))
174
174
  end
175
175
 
176
176
  it 'subject should be parsed correctly' do
@@ -190,7 +190,7 @@ describe 'Jpmobile::Mail#receive' do
190
190
 
191
191
  context 'bounced mail' do
192
192
  it 'should parse sub-part charset correctly' do
193
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/bounce_with_utf8_part.eml')).read)
193
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/bounce_with_utf8_part.eml')))
194
194
  expect(@mail.parts.first.charset).to match(/iso-2022-jp/i)
195
195
  expect(@mail.parts.last.charset).to match(/utf-8/i)
196
196
  end
@@ -199,7 +199,7 @@ describe 'Jpmobile::Mail#receive' do
199
199
 
200
200
  describe 'Docomo' do
201
201
  before(:each) do
202
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/docomo-emoji.eml')).read)
202
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/docomo-emoji.eml')))
203
203
  end
204
204
 
205
205
  it 'subject should be parsed correctly' do
@@ -234,7 +234,7 @@ describe 'Jpmobile::Mail#receive' do
234
234
 
235
235
  context 'JIS mail' do
236
236
  before(:each) do
237
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/docomo-jis.eml')).read)
237
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/docomo-jis.eml')))
238
238
  end
239
239
 
240
240
  it 'subject should be parsed correctly' do
@@ -250,7 +250,7 @@ describe 'Jpmobile::Mail#receive' do
250
250
  describe 'Au' do
251
251
  context 'au-emoji.eml' do
252
252
  before(:each) do
253
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/au-emoji.eml')).read)
253
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/au-emoji.eml')))
254
254
  end
255
255
 
256
256
  it 'subject should be parsed correctly' do
@@ -286,36 +286,36 @@ describe 'Jpmobile::Mail#receive' do
286
286
 
287
287
  it 'should not be raised when parsing incoming email #41' do
288
288
  expect {
289
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/au-email.eml')).read)
289
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/au-email.eml')))
290
290
  }.not_to raise_error
291
291
  end
292
292
 
293
293
  it 'should not be raised when parsing incoming email #45' do
294
294
  expect {
295
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/au-decomail2.eml')).read)
295
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/au-decomail2.eml')))
296
296
  }.not_to raise_error
297
297
  end
298
298
 
299
299
  it 'should not be raised when parsing incoming email - include kigou' do
300
300
  expect {
301
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/au-kigou.eml')).read)
301
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/au-kigou.eml')))
302
302
  }.not_to raise_error
303
303
  end
304
304
 
305
305
  context 'From au iPhone' do
306
306
  it 'charset should be UTF-8' do
307
- @mail = Mail.new(File.open(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/iphone-message.eml')).read)
307
+ @mail = Mail.new(File.read(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/iphone-message.eml')))
308
308
  expect(@mail.mobile).to be_a(Jpmobile::Mobile::Au)
309
309
  expect(@mail.charset).to match(/utf-8/i)
310
310
  end
311
311
 
312
312
  it 'should be encoded correctly' do
313
- @mail = Mail.new(File.open(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/iphone-message.eml')).read)
313
+ @mail = Mail.new(File.read(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/iphone-message.eml')))
314
314
  expect(@mail.encoded).to match(Regexp.escape("%[\e$B1`;yL>\e(B]%\e$B$N\e(B%[\e$BJ]8n<TL>\e(B]%"))
315
315
  end
316
316
 
317
317
  it 'should decode cp932-encoded mail correctly' do
318
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/iphone-cp932.eml')).read)
318
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/iphone-cp932.eml')))
319
319
  expect(@mail.subject).to eq 'Re: 【NKSC】test'
320
320
  expect(@mail.body.to_s).to eq 'テストです。㈱'
321
321
  end
@@ -323,20 +323,20 @@ describe 'Jpmobile::Mail#receive' do
323
323
 
324
324
  context 'From iPad' do
325
325
  it 'charset should be UTF-8' do
326
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/iphone-mail3.eml')).read)
326
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/iphone-mail3.eml')))
327
327
  expect(@mail.mobile).to be_a(Jpmobile::Mobile::AbstractMobile)
328
328
  expect(@mail.charset).to match(/utf-8/i)
329
329
  end
330
330
 
331
331
  it 'should be encoded correctly' do
332
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/iphone-mail3.eml')).read)
332
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/iphone-mail3.eml')))
333
333
  expect(@mail.encoded).to match(/BK\\J82~9T\$J\$7!2#5#1#2J8;z!2/)
334
334
  end
335
335
  end
336
336
 
337
337
  it 'should not raise when parsing attached email' do
338
338
  expect {
339
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/au-attached.eml')).read)
339
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/au-attached.eml')))
340
340
  expect(@mail.encoded).to match('/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAPQAA')
341
341
  }.not_to raise_error
342
342
  end
@@ -344,7 +344,7 @@ describe 'Jpmobile::Mail#receive' do
344
344
 
345
345
  describe 'Softbank' do
346
346
  before(:each) do
347
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/softbank-emoji.eml')).read)
347
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/softbank-emoji.eml')))
348
348
  end
349
349
 
350
350
  it 'subject should be parsed correctly' do
@@ -379,7 +379,7 @@ describe 'Jpmobile::Mail#receive' do
379
379
 
380
380
  describe 'blank-mail' do
381
381
  before(:each) do
382
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/softbank-blank.eml')).read)
382
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/softbank-blank.eml')))
383
383
  end
384
384
 
385
385
  it 'subject should be parsed correctly' do
@@ -395,7 +395,7 @@ describe 'Jpmobile::Mail#receive' do
395
395
  describe 'iPhone' do
396
396
  context 'JIS mail' do
397
397
  before(:each) do
398
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/iphone-jis.eml')).read)
398
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/iphone-jis.eml')))
399
399
  end
400
400
 
401
401
  it 'body should be parsed correctly' do
@@ -405,7 +405,7 @@ describe 'Jpmobile::Mail#receive' do
405
405
 
406
406
  context 'when the mail contains UTF-8 emojis' do
407
407
  before(:each) do
408
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/iphone-unicode-emoji.eml')).read)
408
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/iphone-unicode-emoji.eml')))
409
409
  end
410
410
 
411
411
  it 'subject should be parsed correctly' do
@@ -419,7 +419,7 @@ describe 'Jpmobile::Mail#receive' do
419
419
 
420
420
  context 'when the mail contains circled-numbers' do
421
421
  before(:each) do
422
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/iphone-circled-numbers-in-jis.eml')).read)
422
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/iphone-circled-numbers-in-jis.eml')))
423
423
  end
424
424
 
425
425
  it 'subject should be parsed correctly' do
@@ -435,7 +435,7 @@ describe 'Jpmobile::Mail#receive' do
435
435
  describe 'bounced mail' do
436
436
  context 'has jp address' do
437
437
  before(:each) do
438
- @mail = Mail.new(File.open(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/bounced-jp.eml')).read)
438
+ @mail = Mail.new(File.read(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/bounced-jp.eml')))
439
439
  end
440
440
 
441
441
  it 'mobile should abstract mobile' do
@@ -447,7 +447,7 @@ describe 'Jpmobile::Mail#receive' do
447
447
  describe 'non-Japanese mail' do
448
448
  context 'us-ascii' do
449
449
  before(:each) do
450
- @mail = Mail.new(File.open(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/non-jp.eml')).read)
450
+ @mail = Mail.new(File.read(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/non-jp.eml')))
451
451
  end
452
452
 
453
453
  it 'mobile should be nil' do
@@ -458,7 +458,7 @@ describe 'Jpmobile::Mail#receive' do
458
458
 
459
459
  context 'no From header' do
460
460
  before(:each) do
461
- @mail = Mail.new(File.open(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/no-from.eml')).read)
461
+ @mail = Mail.new(File.read(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/no-from.eml')))
462
462
  end
463
463
 
464
464
  it 'mobile should be nil' do
@@ -3,7 +3,7 @@ class DecoratedMailer < Jpmobile::Mailer::Base
3
3
  default to: 'info@jp.mobile'
4
4
 
5
5
  def deco_mail(to_mail)
6
- attachments.inline['photo.jpg'] = File.open(File.join(Rails.root, 'spec/fixtures/files/mobile_mailer/photo.jpg')).read
6
+ attachments.inline['photo.jpg'] = File.read(File.join(Rails.root, 'spec/fixtures/files/mobile_mailer/photo.jpg'))
7
7
 
8
8
  mail(to: to_mail, subject: '題名', decorated: true)
9
9
  end
@@ -1,3 +1,4 @@
1
+ # rubocop:disable Performance/CollectionLiteralInLoop
1
2
  RailsRoot::Application.routes.draw do
2
3
  resources :users
3
4
  namespace :admin do
@@ -102,3 +103,4 @@ RailsRoot::Application.routes.draw do
102
103
  end
103
104
  end
104
105
  end
106
+ # rubocop:enable Performance/CollectionLiteralInLoop
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jpmobile
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.1
4
+ version: 7.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shin-ichiro OGAWA
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-01-13 00:00:00.000000000 Z
12
+ date: 2022-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mail
@@ -461,7 +461,8 @@ files:
461
461
  homepage: http://jpmobile-rails.org
462
462
  licenses:
463
463
  - MIT
464
- metadata: {}
464
+ metadata:
465
+ rubygems_mfa_required: 'true'
465
466
  post_install_message:
466
467
  rdoc_options: []
467
468
  require_paths:
@@ -477,7 +478,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
477
478
  - !ruby/object:Gem::Version
478
479
  version: '0'
479
480
  requirements: []
480
- rubygems_version: 3.2.32
481
+ rubygems_version: 3.3.7
481
482
  signing_key:
482
483
  specification_version: 4
483
484
  summary: Rails plugin for mobile devices in Japan