jpmobile 7.0.0 → 7.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +5 -2
  3. data/.rubocop.yml +104 -1
  4. data/.ruby-version +1 -1
  5. data/Gemfile.lock +116 -89
  6. data/README.md +24 -3
  7. data/Rakefile +1 -1
  8. data/jpmobile.gemspec +2 -1
  9. data/lib/jpmobile/datum_conv.rb +7 -7
  10. data/lib/jpmobile/email.rb +2 -2
  11. data/lib/jpmobile/fallback_view_selector.rb +2 -2
  12. data/lib/jpmobile/filter.rb +3 -1
  13. data/lib/jpmobile/mail.rb +2 -2
  14. data/lib/jpmobile/mailer.rb +1 -1
  15. data/lib/jpmobile/method_less_action_support.rb +11 -0
  16. data/lib/jpmobile/mobile/abstract_mobile.rb +1 -1
  17. data/lib/jpmobile/mobile/android.rb +1 -1
  18. data/lib/jpmobile/mobile/au.rb +6 -8
  19. data/lib/jpmobile/mobile/black_berry.rb +1 -1
  20. data/lib/jpmobile/mobile/ddipocket.rb +1 -1
  21. data/lib/jpmobile/mobile/docomo.rb +2 -2
  22. data/lib/jpmobile/mobile/emobile.rb +2 -2
  23. data/lib/jpmobile/mobile/ipad.rb +1 -1
  24. data/lib/jpmobile/mobile/iphone.rb +1 -1
  25. data/lib/jpmobile/mobile/softbank.rb +5 -3
  26. data/lib/jpmobile/mobile/vodafone.rb +2 -2
  27. data/lib/jpmobile/mobile/willcom.rb +2 -2
  28. data/lib/jpmobile/mobile/windows_phone.rb +1 -1
  29. data/lib/jpmobile/position.rb +2 -2
  30. data/lib/jpmobile/rails.rb +1 -0
  31. data/lib/jpmobile/template_details.rb +1 -1
  32. data/lib/jpmobile/version.rb +1 -1
  33. data/lib/tasks/jpmobile_tasks.rake +2 -4
  34. data/spec/unit/decorated_mail_spec.rb +1 -1
  35. data/spec/unit/mail_spec.rb +2 -2
  36. data/spec/unit/receive_mail_spec.rb +29 -29
  37. data/test/rails/overrides/app/controllers/method_less_action_support_controller.rb +3 -0
  38. data/test/rails/overrides/app/mailers/decorated_mailer.rb +1 -1
  39. data/test/rails/overrides/app/views/method_less_action_support/index_smart_phone.html.erb +0 -0
  40. data/test/rails/overrides/config/routes.rb +4 -0
  41. data/test/rails/overrides/spec/requests/method_less_action_support_spec.rb +28 -0
  42. metadata +13 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23fd23b1c3355357f297fbfbcd1ccd9bd673a7cd32ac0de550ed5222b9cbe2d1
4
- data.tar.gz: f2432b9a47332debe6dde7bb42b5dc175a6ffa7c0ac70f80ca40ab3a4613a1f8
3
+ metadata.gz: b00599e53c71e6bf45f9d8b953b4e7256d3a0f32f1e7f905006467e4a2dd8095
4
+ data.tar.gz: 935af37ae804e50db7cccf3fa979abddde111ba5f9e9fe61fea57a1420a567d8
5
5
  SHA512:
6
- metadata.gz: 57bf348d59ec1f6b520d363a1b5e8b798a033c10a75d88ca88c8b8539530b436a9711a9882571f21371e1c547654c92c16db1ac50fae9164f4cd0a818b19d262
7
- data.tar.gz: 86b3585c886a0e4ba2a5a94f736b45d3adc8c4c2924572acc477986d8cecb8edf34eed5e06c3fbb2a4f071f2c7f431b9f7e3d5cb1f4f29cb680b5a42d2be2c8b
6
+ metadata.gz: 4f418fba357ce7cd534817f4a398b0308d9baa720196ff6eecdb459806f5c998a1408db386ce9917bf74e62857406dd91f8f6757319b35d95f571a763b2f5ad1
7
+ data.tar.gz: 8067721a16ed607f3074326ebf340be90e6991bdc186a4e9d8f251a8b857b67789d235489d6bf75511f3b7b66923c8a6f1f62ba84df95f2e041143d3b307aa80
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
@@ -34,7 +34,10 @@ jobs:
34
34
 
35
35
  - run:
36
36
  name: Bundle Install
37
- command: bundle check || bundle install --path vendor/bundler
37
+ command: |
38
+ bundle config set --local clean true
39
+ bundle config set --local path vendor/bundle
40
+ bundle check || bundle install
38
41
 
39
42
  # Store bundle cache
40
43
  - save_cache:
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jpmobile (6.1.2)
4
+ jpmobile (7.0.3)
5
5
  mail (~> 2.7.0)
6
6
  rexml
7
7
  scanf
@@ -9,61 +9,67 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (7.0.0)
13
- actionpack (= 7.0.0)
14
- activesupport (= 7.0.0)
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.0)
18
- actionpack (= 7.0.0)
19
- activejob (= 7.0.0)
20
- activerecord (= 7.0.0)
21
- activestorage (= 7.0.0)
22
- activesupport (= 7.0.0)
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
- actionmailer (7.0.0)
25
- actionpack (= 7.0.0)
26
- actionview (= 7.0.0)
27
- activejob (= 7.0.0)
28
- activesupport (= 7.0.0)
24
+ net-imap
25
+ net-pop
26
+ net-smtp
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)
29
32
  mail (~> 2.5, >= 2.5.4)
33
+ net-imap
34
+ net-pop
35
+ net-smtp
30
36
  rails-dom-testing (~> 2.0)
31
- actionpack (7.0.0)
32
- actionview (= 7.0.0)
33
- activesupport (= 7.0.0)
37
+ actionpack (7.0.3)
38
+ actionview (= 7.0.3)
39
+ activesupport (= 7.0.3)
34
40
  rack (~> 2.0, >= 2.2.0)
35
41
  rack-test (>= 0.6.3)
36
42
  rails-dom-testing (~> 2.0)
37
43
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
38
- actiontext (7.0.0)
39
- actionpack (= 7.0.0)
40
- activerecord (= 7.0.0)
41
- activestorage (= 7.0.0)
42
- activesupport (= 7.0.0)
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)
43
49
  globalid (>= 0.6.0)
44
50
  nokogiri (>= 1.8.5)
45
- actionview (7.0.0)
46
- activesupport (= 7.0.0)
51
+ actionview (7.0.3)
52
+ activesupport (= 7.0.3)
47
53
  builder (~> 3.1)
48
54
  erubi (~> 1.4)
49
55
  rails-dom-testing (~> 2.0)
50
56
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
51
- activejob (7.0.0)
52
- activesupport (= 7.0.0)
57
+ activejob (7.0.3)
58
+ activesupport (= 7.0.3)
53
59
  globalid (>= 0.3.6)
54
- activemodel (7.0.0)
55
- activesupport (= 7.0.0)
56
- activerecord (7.0.0)
57
- activemodel (= 7.0.0)
58
- activesupport (= 7.0.0)
59
- activestorage (7.0.0)
60
- actionpack (= 7.0.0)
61
- activejob (= 7.0.0)
62
- activerecord (= 7.0.0)
63
- activesupport (= 7.0.0)
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)
64
70
  marcel (~> 1.0)
65
71
  mini_mime (>= 1.1.0)
66
- activesupport (7.0.0)
72
+ activesupport (7.0.3)
67
73
  concurrent-ruby (~> 1.0, >= 1.0.2)
68
74
  i18n (>= 1.6, < 2)
69
75
  minitest (>= 5.1)
@@ -71,19 +77,20 @@ GEM
71
77
  ast (2.4.2)
72
78
  builder (3.2.4)
73
79
  coderay (1.1.3)
74
- concurrent-ruby (1.1.9)
80
+ concurrent-ruby (1.1.10)
75
81
  crass (1.0.6)
76
- diff-lcs (1.4.4)
82
+ diff-lcs (1.5.0)
83
+ digest (3.1.0)
77
84
  erubi (1.10.0)
78
85
  geokit (1.13.1)
79
- git (1.9.1)
86
+ git (1.11.0)
80
87
  rchardet (~> 1.8)
81
88
  globalid (1.0.0)
82
89
  activesupport (>= 5.0)
83
90
  hpricot (0.8.6)
84
- i18n (1.8.11)
91
+ i18n (1.10.0)
85
92
  concurrent-ruby (~> 1.0)
86
- loofah (2.13.0)
93
+ loofah (2.18.0)
87
94
  crass (~> 1.0.2)
88
95
  nokogiri (>= 1.5.9)
89
96
  mail (2.7.1)
@@ -92,66 +99,82 @@ GEM
92
99
  method_source (1.0.0)
93
100
  mini_mime (1.1.2)
94
101
  minitest (5.15.0)
102
+ net-imap (0.2.3)
103
+ digest
104
+ net-protocol
105
+ strscan
106
+ net-pop (0.1.1)
107
+ digest
108
+ net-protocol
109
+ timeout
110
+ net-protocol (0.1.3)
111
+ timeout
112
+ net-smtp (0.3.1)
113
+ digest
114
+ net-protocol
115
+ timeout
95
116
  nio4r (2.5.8)
96
- nokogiri (1.12.5-arm64-darwin)
117
+ nokogiri (1.13.6-arm64-darwin)
97
118
  racc (~> 1.4)
98
- parallel (1.21.0)
99
- parser (3.0.3.2)
119
+ nokogiri (1.13.6-x86_64-linux)
120
+ racc (~> 1.4)
121
+ parallel (1.22.1)
122
+ parser (3.1.2.0)
100
123
  ast (~> 2.4.1)
101
124
  pry (0.14.1)
102
125
  coderay (~> 1.1)
103
126
  method_source (~> 1.0)
104
127
  racc (1.6.0)
105
- rack (2.2.3)
128
+ rack (2.2.3.1)
106
129
  rack-test (1.1.0)
107
130
  rack (>= 1.0, < 3)
108
- rails (7.0.0)
109
- actioncable (= 7.0.0)
110
- actionmailbox (= 7.0.0)
111
- actionmailer (= 7.0.0)
112
- actionpack (= 7.0.0)
113
- actiontext (= 7.0.0)
114
- actionview (= 7.0.0)
115
- activejob (= 7.0.0)
116
- activemodel (= 7.0.0)
117
- activerecord (= 7.0.0)
118
- activestorage (= 7.0.0)
119
- activesupport (= 7.0.0)
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)
120
143
  bundler (>= 1.15.0)
121
- railties (= 7.0.0)
144
+ railties (= 7.0.3)
122
145
  rails-dom-testing (2.0.3)
123
146
  activesupport (>= 4.2.0)
124
147
  nokogiri (>= 1.6)
125
148
  rails-html-sanitizer (1.4.2)
126
149
  loofah (~> 2.3)
127
- railties (7.0.0)
128
- actionpack (= 7.0.0)
129
- activesupport (= 7.0.0)
150
+ railties (7.0.3)
151
+ actionpack (= 7.0.3)
152
+ activesupport (= 7.0.3)
130
153
  method_source
131
154
  rake (>= 12.2)
132
155
  thor (~> 1.0)
133
156
  zeitwerk (~> 2.5)
134
- rainbow (3.0.0)
157
+ rainbow (3.1.1)
135
158
  rake (13.0.6)
136
159
  rchardet (1.8.0)
137
- regexp_parser (2.2.0)
160
+ regexp_parser (2.5.0)
138
161
  rexml (3.2.5)
139
- rspec (3.10.0)
140
- rspec-core (~> 3.10.0)
141
- rspec-expectations (~> 3.10.0)
142
- rspec-mocks (~> 3.10.0)
143
- rspec-core (3.10.1)
144
- rspec-support (~> 3.10.0)
145
- 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)
146
169
  diff-lcs (>= 1.2.0, < 2.0)
147
- rspec-support (~> 3.10.0)
170
+ rspec-support (~> 3.11.0)
148
171
  rspec-its (1.3.0)
149
172
  rspec-core (>= 3.0.0)
150
173
  rspec-expectations (>= 3.0.0)
151
- rspec-mocks (3.10.2)
174
+ rspec-mocks (3.11.1)
152
175
  diff-lcs (>= 1.2.0, < 2.0)
153
- rspec-support (~> 3.10.0)
154
- rspec-rails (5.0.2)
176
+ rspec-support (~> 3.11.0)
177
+ rspec-rails (5.1.2)
155
178
  actionpack (>= 5.2)
156
179
  activesupport (>= 5.2)
157
180
  railties (>= 5.2)
@@ -159,43 +182,47 @@ GEM
159
182
  rspec-expectations (~> 3.10)
160
183
  rspec-mocks (~> 3.10)
161
184
  rspec-support (~> 3.10)
162
- rspec-support (3.10.3)
163
- rubocop (1.23.0)
185
+ rspec-support (3.11.0)
186
+ rubocop (1.30.0)
164
187
  parallel (~> 1.10)
165
- parser (>= 3.0.0.0)
188
+ parser (>= 3.1.0.0)
166
189
  rainbow (>= 2.2.2, < 4.0)
167
190
  regexp_parser (>= 1.8, < 3.0)
168
- rexml
169
- rubocop-ast (>= 1.12.0, < 2.0)
191
+ rexml (>= 3.2.5, < 4.0)
192
+ rubocop-ast (>= 1.18.0, < 2.0)
170
193
  ruby-progressbar (~> 1.7)
171
194
  unicode-display_width (>= 1.4.0, < 3.0)
172
- rubocop-ast (1.15.0)
173
- parser (>= 3.0.1.1)
174
- rubocop-performance (1.12.0)
195
+ rubocop-ast (1.18.0)
196
+ parser (>= 3.1.1.0)
197
+ rubocop-performance (1.14.0)
175
198
  rubocop (>= 1.7.0, < 2.0)
176
199
  rubocop-ast (>= 0.4.0)
177
- rubocop-rails (2.12.4)
200
+ rubocop-rails (2.14.2)
178
201
  activesupport (>= 4.2.0)
179
202
  rack (>= 1.1)
180
203
  rubocop (>= 1.7.0, < 2.0)
181
- rubocop-rspec (2.6.0)
204
+ rubocop-rspec (2.11.1)
182
205
  rubocop (~> 1.19)
183
206
  ruby-progressbar (1.11.0)
184
207
  scanf (1.0.0)
185
208
  sqlite3 (1.4.2)
186
209
  sqlite3-ruby (1.3.3)
187
210
  sqlite3 (>= 1.3.3)
188
- thor (1.1.0)
211
+ strscan (3.0.3)
212
+ thor (1.2.1)
213
+ timeout (0.3.0)
189
214
  tzinfo (2.0.4)
190
215
  concurrent-ruby (~> 1.0)
191
216
  unicode-display_width (2.1.0)
192
217
  websocket-driver (0.7.5)
193
218
  websocket-extensions (>= 0.1.0)
194
219
  websocket-extensions (0.1.5)
195
- zeitwerk (2.5.1)
220
+ zeitwerk (2.5.4)
196
221
 
197
222
  PLATFORMS
198
223
  arm64-darwin-20
224
+ arm64-darwin-21
225
+ x86_64-linux
199
226
 
200
227
  DEPENDENCIES
201
228
  geokit
@@ -214,4 +241,4 @@ DEPENDENCIES
214
241
  sqlite3-ruby
215
242
 
216
243
  BUNDLED WITH
217
- 2.2.32
244
+ 2.3.15
data/README.md CHANGED
@@ -140,10 +140,9 @@ 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
- vendor/plugins/geokit以下にGeoKitがインストールされていると、Jpmobile::PositionにGeoKit::Mappabl
146
- eがincludeされる。したがって、
145
+ vendor/plugins/geokit以下にGeoKitがインストールされていると、Jpmobile::PositionにGeoKit::Mappableがincludeされる。したがって、
147
146
 
148
147
  ```ruby
149
148
  request.mobile.position.distance_to('札幌駅')
@@ -295,6 +294,28 @@ def index
295
294
  end
296
295
  ```
297
296
 
297
+ ### アクション定義の省略
298
+
299
+ Railsでは、アクション名に対応するテンプレートが存在する場合、アクション用のメソッド定義を省略できる。
300
+
301
+ しかし、端末向けテンプレートしか存在しないアクションの場合、jpmobileではメソッド定義を省略することを許していない。
302
+
303
+ ```ruby
304
+ class MyController < ApplicationController
305
+ # app/views/my/index_smart_phone.html.erb がある場合でも、次のメソッド定義は必須。
306
+ def index
307
+ end
308
+ end
309
+ ```
310
+
311
+ 次のように設定を加えると、これを省略できるようになる。
312
+
313
+ ```ruby
314
+ class MyController < ApplicationController
315
+ include Jpmobile::MethodLessActionSupport
316
+ end
317
+ ```
318
+
298
319
  ### 位置情報の取得用リンクの生成
299
320
 
300
321
  以下のようなコードで、端末に位置情報を要求するリンクを出力する。
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
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.test_files = gem.files.grep(%r{^(test|spec|system)/})
17
17
  gem.require_paths = ['lib']
18
18
 
19
- gem.required_ruby_version = '>= 3.0.0'
19
+ gem.required_ruby_version = '>= 2.7.0'
20
20
 
21
21
  gem.add_dependency 'mail', '~> 2.7.0'
22
22
  gem.add_dependency 'rexml'
@@ -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
@@ -0,0 +1,11 @@
1
+ module Jpmobile
2
+ module MethodLessActionSupport
3
+ def template_exists?(*args, **kwargs, &block)
4
+ super(
5
+ *args,
6
+ **kwargs.reverse_merge(mobile: request.mobile&.variants || []),
7
+ &block
8
+ )
9
+ end
10
+ end
11
+ end
@@ -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