jpmobile 7.1.0 → 7.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +2 -2
  3. data/.rubocop.yml +48 -3
  4. data/.ruby-version +1 -1
  5. data/Gemfile +1 -4
  6. data/Gemfile.lock +147 -158
  7. data/jpmobile.gemspec +2 -2
  8. data/lib/jpmobile/email.rb +1 -1
  9. data/lib/jpmobile/emoticon.rb +1 -2
  10. data/lib/jpmobile/fallback_view_selector.rb +1 -1
  11. data/lib/jpmobile/filter.rb +1 -1
  12. data/lib/jpmobile/helpers.rb +1 -1
  13. data/lib/jpmobile/hook_template_details_requested.rb +1 -1
  14. data/lib/jpmobile/mail.rb +22 -24
  15. data/lib/jpmobile/mailer.rb +4 -4
  16. data/lib/jpmobile/method_less_action_support.rb +3 -3
  17. data/lib/jpmobile/mobile/abstract_mobile.rb +8 -8
  18. data/lib/jpmobile/mobile/android.rb +1 -1
  19. data/lib/jpmobile/mobile/au.rb +2 -2
  20. data/lib/jpmobile/mobile/black_berry.rb +1 -1
  21. data/lib/jpmobile/mobile/ddipocket.rb +1 -1
  22. data/lib/jpmobile/mobile/docomo.rb +2 -2
  23. data/lib/jpmobile/mobile/emobile.rb +2 -2
  24. data/lib/jpmobile/mobile/ipad.rb +1 -1
  25. data/lib/jpmobile/mobile/iphone.rb +1 -1
  26. data/lib/jpmobile/mobile/softbank.rb +2 -2
  27. data/lib/jpmobile/mobile/vodafone.rb +2 -2
  28. data/lib/jpmobile/mobile/willcom.rb +2 -2
  29. data/lib/jpmobile/mobile/windows_phone.rb +1 -1
  30. data/lib/jpmobile/path_set.rb +1 -1
  31. data/lib/jpmobile/rack/filter.rb +2 -0
  32. data/lib/jpmobile/resolver.rb +1 -1
  33. data/lib/jpmobile/session/active_record_store.rb +1 -1
  34. data/lib/jpmobile/session/mem_cache_store.rb +1 -1
  35. data/lib/jpmobile/template_details.rb +1 -1
  36. data/lib/jpmobile/trans_sid.rb +1 -1
  37. data/lib/jpmobile/version.rb +1 -1
  38. data/spec/rack_helper.rb +0 -1
  39. data/spec/unit/email_spec.rb +2 -2
  40. data/spec/unit/is_carrier_spec.rb +1 -1
  41. data/spec/unit/receive_mail_spec.rb +1 -1
  42. data/spec/unit/util_spec.rb +0 -1
  43. data/test/rails/overrides/spec/controllers/hankaku_filter_controller_spec.rb +1 -1
  44. data/test/rails/overrides/spec/controllers/helpers_spec.rb +1 -1
  45. data/test/rails/overrides/spec/rails_helper.rb +3 -1
  46. data/test/rails/overrides/spec/requests/method_less_action_support_spec.rb +1 -1
  47. data/test/rails/overrides/spec/system_helper.rb +1 -1
  48. data/test/sinatra/guestbook.rb +1 -1
  49. metadata +6 -9
  50. data/tools/generate_au_emoticon_table.rb +0 -34
  51. data/tools/generate_docomo_emoticon_table.rb +0 -33
  52. data/tools/generate_softbank_emoticon_table.rb +0 -31
data/lib/jpmobile/mail.rb CHANGED
@@ -2,14 +2,6 @@ require 'mail'
2
2
 
3
3
  module Mail
4
4
  # encoding patch
5
- Ruby19.class_eval do
6
- # change encoding
7
- def self.b_value_encode(str, encoding = nil)
8
- str = Jpmobile::Util.encode(str, encoding.to_s)
9
- [Ruby19.encode_base64(str), encoding]
10
- end
11
- end
12
-
13
5
  class Message
14
6
  attr_reader :mobile
15
7
 
@@ -55,7 +47,9 @@ module Mail
55
47
 
56
48
  def parse_message_with_jpmobile
57
49
  _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})/mo, 2)
50
+ header_part, body_part = _crlf_raw_source.lstrip.split(
51
+ /#{Constants::CRLF}#{Constants::CRLF}|#{Constants::CRLF}#{Constants::WSP}*#{Constants::CRLF}(?!#{Constants::WSP})/mo, 2
52
+ )
59
53
  # header_part, body_part = raw_source.lstrip.split(HEADER_SEPARATOR, 2)
60
54
 
61
55
  self.header = header_part
@@ -277,9 +271,9 @@ module Mail
277
271
  end
278
272
 
279
273
  def parse_message_with_jpmobile
280
- header_part, body_part = raw_source.split(/#{CRLF}#{WSP}*#{CRLF}/mo, 2)
274
+ header_part, body_part = raw_source.split(/#{Constants::CRLF}#{Constants::WSP}*#{Constants::CRLF}/mo, 2)
281
275
 
282
- self.header = if header_part && header_part.match(HEADER_LINE)
276
+ self.header = if header_part && header_part.match(Constants::HEADER_LINE)
283
277
  header_part
284
278
  else
285
279
  "Content-Type: text/plain\r\n"
@@ -321,7 +315,7 @@ module Mail
321
315
  end
322
316
  Jpmobile::Util.set_encoding(_raw_source, @mobile.mail_charset(@charset))
323
317
  when /quoted-printable/
324
- Jpmobile::Util.set_encoding([@mobile.to_mail_body(@raw_source)].pack('M').gsub(/\n/, "\r\n"), @mobile.mail_charset(@charset))
318
+ Jpmobile::Util.set_encoding([@mobile.to_mail_body(@raw_source)].pack('M').gsub("\n", "\r\n"), @mobile.mail_charset(@charset))
325
319
  else
326
320
  @mobile.to_mail_body(Jpmobile::Util.force_encode(@raw_source, nil, Jpmobile::Util::UTF8))
327
321
  end
@@ -429,6 +423,10 @@ module Mail
429
423
  end
430
424
  end
431
425
 
426
+ class NamedUnstructuredField
427
+ attr_accessor :mobile
428
+ end
429
+
432
430
  class UnstructuredField
433
431
  attr_accessor :mobile
434
432
  end
@@ -440,7 +438,7 @@ module Mail
440
438
  end
441
439
 
442
440
  # for subject
443
- class SubjectField < UnstructuredField
441
+ class SubjectField < NamedUnstructuredField
444
442
  def encoded_with_jpmobile
445
443
  if @mobile
446
444
  if @mobile.to_mail_subject_encoded?(value)
@@ -482,7 +480,7 @@ module Mail
482
480
  match = str.match(/=\?(.+)?\?[Bb]\?(.*)\?=/m)
483
481
  if match
484
482
  charset = match[1]
485
- str = Ruby19.decode_base64(match[2])
483
+ str = Utilities.decode_base64(match[2])
486
484
  @mobile.decode_transfer_encoding(str, charset)
487
485
  else
488
486
  str
@@ -494,7 +492,7 @@ module Mail
494
492
  attr_accessor :mobile
495
493
  end
496
494
 
497
- class FromField < StructuredField
495
+ class FromField < CommonAddressField
498
496
  def initialize_with_jpmobile(value = nil, charset = 'utf-8')
499
497
  @jpmobile_raw_text = value
500
498
  initialize_without_jpmobile(value, charset)
@@ -516,14 +514,14 @@ module Mail
516
514
  if @mobile
517
515
  self.charset = @mobile.mail_charset
518
516
 
519
- _value = address_list.addresses.map {|_a|
517
+ _value = element.addresses.map {|_a|
520
518
  if Utilities.blank?(_a.display_name) || _a.display_name.ascii_only?
521
519
  _a.to_s
522
520
  else
523
521
  "#{@mobile.to_mail_subject(_a.display_name)} <#{_a.address}>"
524
522
  end
525
523
  }.join(', ')
526
- @address_list = AddressList.new(_value)
524
+ @element = AddressList.new(_value)
527
525
  end
528
526
 
529
527
  encoded_without_jpmobile
@@ -533,7 +531,7 @@ module Mail
533
531
  alias_method :encoded, :encoded_with_jpmobile
534
532
  end
535
533
 
536
- class ToField < StructuredField
534
+ class ToField < CommonAddressField
537
535
  def initialize_with_jpmobile(value = nil, charset = 'utf-8')
538
536
  @jpmobile_raw_text = value
539
537
  initialize_without_jpmobile(value, charset)
@@ -555,14 +553,14 @@ module Mail
555
553
  if @mobile
556
554
  self.charset = @mobile.mail_charset
557
555
 
558
- _value = address_list.addresses.map {|_a|
556
+ _value = element.addresses.map {|_a|
559
557
  if Utilities.blank?(_a.display_name) || _a.display_name.ascii_only?
560
558
  _a.to_s
561
559
  else
562
560
  "#{@mobile.to_mail_subject(_a.display_name)} <#{_a.address}>"
563
561
  end
564
562
  }.join(', ')
565
- @address_list = AddressList.new(_value)
563
+ @element = AddressList.new(_value)
566
564
  end
567
565
 
568
566
  encoded_without_jpmobile
@@ -596,7 +594,7 @@ module Mail
596
594
  class ContentTypeElement # :nodoc:
597
595
  def initialize_with_jpmobile(string)
598
596
  if (m = string.match(/\A(.*?)(name|filename)=("|')(.+)("|')(.*?)\z/)) &&
599
- m[4].each_byte.detect {|b| (b == 0 || b > 127) }
597
+ m[4].each_byte.detect {|b| b == 0 || b > 127 }
600
598
  name = [m[4]].pack('m').strip
601
599
  string = "#{m[1]}#{m[2]}=#{m[3]}#{name}#{m[5]}#{m[6]}"
602
600
  end
@@ -610,7 +608,7 @@ module Mail
610
608
  class ContentDispositionElement # :nodoc:
611
609
  def initialize_with_jpmobile(string)
612
610
  if (m = string.match(/\A(.*?)(name|filename)=("|')(.+)("|')(.*?)\z/)) &&
613
- m[4].each_byte.detect {|b| (b == 0 || b > 127) }
611
+ m[4].each_byte.detect {|b| b == 0 || b > 127 }
614
612
  name = [m[4]].pack('m').strip
615
613
  string = "#{m[1]}#{m[2]}=#{m[3]}#{name}#{m[5]}#{m[6]}"
616
614
  end
@@ -624,7 +622,7 @@ module Mail
624
622
  class ContentLocationElement # :nodoc:
625
623
  def initialize_with_jpmobile(string)
626
624
  if (m = string.match(/\A(.*?)(name|filename)=("|')(.+)("|')(.*?)\z/)) &&
627
- m[4].each_byte.detect {|b| (b == 0 || b > 127) }
625
+ m[4].each_byte.detect {|b| b == 0 || b > 127 }
628
626
  name = [m[4]].pack('m').strip
629
627
  string = "#{m[1]}#{m[2]}=#{m[3]}#{name}#{m[5]}#{m[6]}"
630
628
  end
@@ -647,7 +645,7 @@ module Mail
647
645
  end
648
646
 
649
647
  IO.popen("#{path} #{arguments} #{destinations}", 'w+') do |io|
650
- io.puts encoded_mail.gsub(/\r\r\n/, "\n").to_lf
648
+ io.puts encoded_mail.gsub("\r\r\n", "\n").to_lf
651
649
  io.flush
652
650
  end
653
651
  end
@@ -1,14 +1,14 @@
1
1
  require 'jpmobile/mail'
2
2
  require 'jpmobile/lookup_context'
3
3
 
4
- Jpmobile::Email.japanese_mail_address_regexp = Regexp.new(/\.jp(?:[^a-zA-Z.-]|$)/)
4
+ Jpmobile::Email.japanese_mail_address_regexp = /\.jp(?:[^a-zA-Z.-]|$)/
5
5
 
6
6
  module Jpmobile
7
7
  module Mailer
8
8
  class Base < ActionMailer::Base
9
9
  self.prepend_view_path(Jpmobile::Resolver.new(File.join(::Rails.root, 'app/views')))
10
10
 
11
- def mail(headers = {}, &block)
11
+ def mail(headers = {}, &)
12
12
  tos = headers[:to] || self.default_params[:to]
13
13
  tos = tos.split(',')
14
14
 
@@ -23,7 +23,7 @@ module Jpmobile
23
23
 
24
24
  @mobile.decorated = headers.delete(:decorated)
25
25
 
26
- m = super(headers, &block)
26
+ m = super
27
27
 
28
28
  m.mobile = @mobile
29
29
 
@@ -39,7 +39,7 @@ module Jpmobile
39
39
  def set_payload_for_mail(payload, mail) # :nodoc:
40
40
  super
41
41
 
42
- payload[:mail] = Jpmobile::Util.ascii_8bit(mail.encoded).gsub(/\r\n/, "\n")
42
+ payload[:mail] = Jpmobile::Util.ascii_8bit(mail.encoded).gsub("\r\n", "\n")
43
43
  end
44
44
  end
45
45
  end
@@ -1,10 +1,10 @@
1
1
  module Jpmobile
2
2
  module MethodLessActionSupport
3
- def template_exists?(*args, **kwargs, &block)
3
+ def template_exists?(*, **kwargs, &)
4
4
  super(
5
- *args,
5
+ *,
6
6
  **kwargs.reverse_merge(mobile: request.mobile&.variants || []),
7
- &block
7
+ &
8
8
  )
9
9
  end
10
10
  end
@@ -96,11 +96,11 @@ module Jpmobile::Mobile
96
96
 
97
97
  @_variants = self.class.ancestors.select {|c| c.to_s =~ /^Jpmobile/ && c.to_s !~ /Emoticon/ }.map do |klass|
98
98
  klass = klass.to_s.
99
- gsub(/Jpmobile::/, '').
100
- gsub(/AbstractMobile::/, '').
101
- gsub(/Mobile::SmartPhone/, 'smart_phone').
102
- gsub(/Mobile::Tablet/, 'tablet').
103
- gsub(/::/, '_').
99
+ gsub('Jpmobile::', '').
100
+ gsub('AbstractMobile::', '').
101
+ gsub('Mobile::SmartPhone', 'smart_phone').
102
+ gsub('Mobile::Tablet', 'tablet').
103
+ gsub('::', '_').
104
104
  gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
105
105
  gsub(/([a-z\d])([A-Z])/, '\1_\2').
106
106
  downcase
@@ -108,9 +108,9 @@ module Jpmobile::Mobile
108
108
  end
109
109
 
110
110
  if @_variants.include?('tablet')
111
- @_variants = @_variants.reject {|v| v == 'mobile' }.map {|v| v.gsub(/mobile_/, 'tablet_') }
111
+ @_variants = @_variants.reject {|v| v == 'mobile' }.map {|v| v.gsub('mobile_', 'tablet_') }
112
112
  elsif @_variants.include?('smart_phone')
113
- @_variants = @_variants.reject {|v| v == 'mobile' }.map {|v| v.gsub(/mobile_/, 'smart_phone_') }
113
+ @_variants = @_variants.reject {|v| v == 'mobile' }.map {|v| v.gsub('mobile_', 'smart_phone_') }
114
114
  end
115
115
 
116
116
  @_variants || []
@@ -253,7 +253,7 @@ module Jpmobile::Mobile
253
253
  carrier_class = Jpmobile::Mobile.const_get(carrier)
254
254
  next if carrier_class == self
255
255
 
256
- define_method "#{carrier.downcase}?" do
256
+ define_method :"#{carrier.downcase}?" do
257
257
  self.is_a?(carrier_class)
258
258
  end
259
259
  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/.freeze
9
+ USER_AGENT_REGEXP = /Android/
10
10
  end
11
11
  end
@@ -6,9 +6,9 @@ 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/.+?)-(.+?) }.freeze
9
+ USER_AGENT_REGEXP = %r{^(?:KDDI|UP.Browser/.+?)-(.+?) }
10
10
  # 対応するメールアドレスの正規表現
11
- MAIL_ADDRESS_REGEXP = /.+@ezweb\.ne\.jp/.freeze
11
+ MAIL_ADDRESS_REGEXP = /.+@ezweb\.ne\.jp/
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
@@ -4,6 +4,6 @@ module Jpmobile::Mobile
4
4
  # ==BlackBerry
5
5
  class BlackBerry < SmartPhone
6
6
  # 対応するUser-Agentの正規表現
7
- USER_AGENT_REGEXP = /BlackBerry/.freeze
7
+ USER_AGENT_REGEXP = /BlackBerry/
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}.freeze
7
+ USER_AGENT_REGEXP = %r{^Mozilla/3.0\(DDIPOCKET}
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/.freeze
7
+ USER_AGENT_REGEXP = /^DoCoMo/
8
8
  # 対応するメールアドレスの正規表現
9
- MAIL_ADDRESS_REGEXP = /.+@docomo\.ne\.jp/.freeze
9
+ MAIL_ADDRESS_REGEXP = /.+@docomo\.ne\.jp/
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$}.freeze
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$}
7
7
  # 対応するメールアドレスの正規表現
8
- MAIL_ADDRESS_REGEXP = /.+@emnet\.ne\.jp/.freeze
8
+ MAIL_ADDRESS_REGEXP = /.+@emnet\.ne\.jp/
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/.freeze
9
+ USER_AGENT_REGEXP = /iPad/
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/.freeze
9
+ USER_AGENT_REGEXP = /iPhone/
10
10
  end
11
11
  end
@@ -5,9 +5,9 @@ module Jpmobile::Mobile
5
5
  # Vodafoneのスーパクラス。
6
6
  class Softbank < AbstractMobile
7
7
  # 対応するuser-agentの正規表現
8
- USER_AGENT_REGEXP = /^(?:SoftBank|Semulator)/.freeze
8
+ USER_AGENT_REGEXP = /^(?:SoftBank|Semulator)/
9
9
  # 対応するメールアドレスの正規表現 ディズニーモバイル対応
10
- MAIL_ADDRESS_REGEXP = /.+@(?:softbank\.ne\.jp|disney\.ne\.jp)/.freeze
10
+ MAIL_ADDRESS_REGEXP = /.+@(?:softbank\.ne\.jp|disney\.ne\.jp)/
11
11
  # メールのデフォルトのcharset
12
12
  MAIL_CHARSET = 'Shift_JIS'.freeze
13
13
  # テキスト部分の content-transfer-encoding
@@ -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)/.freeze
7
+ USER_AGENT_REGEXP = /^(Vodafone|Vemulator)/
8
8
  # 対応するメールアドレスの正規表現
9
- MAIL_ADDRESS_REGEXP = /.+@[dhtcrknsq]\.vodafone\.ne\.jp/.freeze
9
+ MAIL_ADDRESS_REGEXP = /.+@[dhtcrknsq]\.vodafone\.ne\.jp/
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}.freeze
7
+ USER_AGENT_REGEXP = %r{^Mozilla/3.0\(WILLCOM}
8
8
  # 対応するメールアドレスの正規表現
9
- MAIL_ADDRESS_REGEXP = /.+@((.+\.)?pdx\.ne\.jp|willcom\.com)/.freeze
9
+ MAIL_ADDRESS_REGEXP = /.+@((.+\.)?pdx\.ne\.jp|willcom\.com)/
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/.freeze
7
+ USER_AGENT_REGEXP = /Windows Phone/
8
8
  end
9
9
  end
@@ -8,7 +8,7 @@ module Jpmobile
8
8
  when Pathname, String
9
9
  Jpmobile::Resolver.new path.to_s
10
10
  else
11
- super(paths)
11
+ super
12
12
  end
13
13
  end
14
14
  end
@@ -43,11 +43,13 @@ module Jpmobile
43
43
  if response.respond_to?(:to_str)
44
44
  response.to_str
45
45
  elsif response.respond_to?(:each)
46
+ # rubocop:disable Style/MapIntoArray
46
47
  body = []
47
48
  response.each do |part|
48
49
  body << response_to_body(part)
49
50
  end
50
51
  body.join("\n")
52
+ # rubocop:enable Style/MapIntoArray
51
53
  else
52
54
  body
53
55
  end
@@ -1,7 +1,7 @@
1
1
  module Jpmobile
2
2
  class Resolver < ::ActionView::FileSystemResolver
3
3
  def initialize(path)
4
- super(path)
4
+ super
5
5
 
6
6
  @path_parser = Jpmobile::Resolver::PathParser.new
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module Jpmobile
2
2
  module ActiveRecordStoreRegenerateSessionId
3
3
  def destroy_session(env, session_id, options)
4
- super(env, session_id, options)
4
+ super
5
5
 
6
6
  session_id || Jpmobile::SessionID.generate_sid
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module Jpmobile
2
2
  module MemCacheStoreRegenerateSessionId
3
3
  def destroy_session(env, session_id, options)
4
- super(env, session_id, options)
4
+ super
5
5
 
6
6
  session_id || generate_sid
7
7
  end
@@ -28,7 +28,7 @@ module Jpmobile
28
28
  attr_reader :mobile, :mobile_idx
29
29
 
30
30
  def initialize(locale:, handlers:, formats:, variants:, mobile:)
31
- super(locale: locale, handlers: handlers, formats: formats, variants: variants)
31
+ super(locale:, handlers:, formats:, variants:)
32
32
 
33
33
  @mobile = mobile.map(&:to_sym)
34
34
  @mobile_idx = build_idx_hash(mobile)
@@ -85,7 +85,7 @@ module Jpmobile
85
85
  end
86
86
  end
87
87
 
88
- super(options, response_status)
88
+ super
89
89
  end
90
90
  end
91
91
  end
@@ -1,3 +1,3 @@
1
1
  module Jpmobile
2
- VERSION = '7.1.0'.freeze
2
+ VERSION = '7.2.0'.freeze
3
3
  end
data/spec/rack_helper.rb CHANGED
@@ -3,7 +3,6 @@ require 'rubygems'
3
3
  require 'rack/test'
4
4
  require 'rspec'
5
5
  require 'jpmobile'
6
- require 'nkf'
7
6
 
8
7
  begin
9
8
  require File.dirname(__FILE__) + '/../vendor/jpmobile-ipaddresses/lib/jpmobile-ipaddresses'
@@ -56,7 +56,7 @@ describe 'Jpmobile::Email' do
56
56
 
57
57
  describe 'japanese_mail_address_regexp' do
58
58
  before do
59
- Jpmobile::Email.japanese_mail_address_regexp = Regexp.new(/\.jp(?:[^a-zA-Z.-]|$)/)
59
+ Jpmobile::Email.japanese_mail_address_regexp = /\.jp(?:[^a-zA-Z.-]|$)/
60
60
  end
61
61
 
62
62
  it '#detect_from_mail_header should return Jpmobile::Mobile::AbstractMobile when the header contains .jp address' do
@@ -80,7 +80,7 @@ describe 'Jpmobile::Email' do
80
80
  end
81
81
 
82
82
  it 'return nil when image/jpeg; name="20098calendar01.jpg"' do
83
- expect(Jpmobile::Email.convertable?('image/jpeg; name="20098calendar01.jpg"')).to be_nil
83
+ expect(Jpmobile::Email.convertable?('image/jpeg; name="20098calendar01.jpg"')).to be_falsy
84
84
  end
85
85
  end
86
86
  end
@@ -59,7 +59,7 @@ describe 'Jpmobile::Mobile' do
59
59
  [%w[Ddipocket ddipocket], true],
60
60
  ].each do |carrier, expected|
61
61
  it "#{carrier.first}##{carrier.last}? should be return #{expected}" do
62
- expect(Jpmobile::Mobile.const_get(carrier.first).new({}, {}).__send__("#{carrier.last}?")).to eq(expected)
62
+ expect(Jpmobile::Mobile.const_get(carrier.first).new({}, {}).__send__(:"#{carrier.last}?")).to eq(expected)
63
63
  end
64
64
  end
65
65
  end
@@ -7,7 +7,7 @@ describe 'Jpmobile::Mail#receive' do
7
7
 
8
8
  before(:each) do
9
9
  @to = 'info@jpmobile-rails.org'
10
- Jpmobile::Email.japanese_mail_address_regexp = Regexp.new(/\.jp[^a-zA-Z.-]/)
10
+ Jpmobile::Email.japanese_mail_address_regexp = /\.jp[^a-zA-Z.-]/
11
11
  end
12
12
 
13
13
  describe 'PC mail' do
@@ -1,6 +1,5 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
2
2
  require 'stringio'
3
- require 'nkf'
4
3
 
5
4
  describe Jpmobile::Util do
6
5
  include Jpmobile::Util
@@ -6,7 +6,7 @@ describe HankakuFilterController, type: :controller do
6
6
 
7
7
  it 'should be successful' do
8
8
  request.user_agent = 'DoCoMo/2.0 P05C(c500;TB;W24H16)'
9
- get 'index', params: params
9
+ get('index', params:)
10
10
  expect(response).to be_successful
11
11
  expect(request.mobile?).to be_truthy
12
12
  end
@@ -9,7 +9,7 @@ describe LinksController, type: :controller do
9
9
  def get_href_and_texts(str)
10
10
  results = []
11
11
  (Nokogiri::HTML.parse(str) / 'a').each do |link|
12
- path, query = link['href'].split(/\?/, 2)
12
+ path, query = link['href'].split('?', 2)
13
13
  params = query.nil? ? nil : Rack::Utils.parse_query(query)
14
14
  results << [link.inner_html, link.attributes, path, params]
15
15
  end
@@ -28,7 +28,9 @@ ActiveRecord::Migration.maintain_test_schema!
28
28
 
29
29
  RSpec.configure do |config|
30
30
  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
31
- config.fixture_path = "#{Rails.root}/spec/fixtures"
31
+ config.fixture_paths = [
32
+ "#{Rails.root}/spec/fixtures",
33
+ ]
32
34
 
33
35
  # If you're not using ActiveRecord, or you'd prefer not to run each of your
34
36
  # examples within a transaction, remove the following line or assign false
@@ -2,7 +2,7 @@ require 'rails_helper'
2
2
 
3
3
  describe 'Method-less mobile template only action', type: :request do
4
4
  subject do
5
- get '/method_less_action_support', headers: headers
5
+ get '/method_less_action_support', headers:
6
6
  end
7
7
 
8
8
  let(:headers) do
@@ -1,3 +1,3 @@
1
1
  require 'rails_helper'
2
2
 
3
- Dir[File.join(__dir__, 'system/support/**/*.rb')].sort.each {|file| require file }
3
+ Dir[File.join(__dir__, 'system/support/**/*.rb')].each {|file| require file }
@@ -23,7 +23,7 @@ class Guestbook < Jpmobile::Sinatra::Base
23
23
  end
24
24
 
25
25
  def assigns(sym)
26
- instance_variable_get("@#{sym}")
26
+ instance_variable_get(:"@#{sym}")
27
27
  end
28
28
 
29
29
  get '/' do
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.1.0
4
+ version: 7.2.0
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: 2023-10-06 00:00:00.000000000 Z
12
+ date: 2024-08-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mail
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 2.7.0
20
+ version: 2.8.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 2.7.0
27
+ version: 2.8.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rexml
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -332,10 +332,7 @@ files:
332
332
  - tools/e4u_conv.rb
333
333
  - tools/emoji/genregexp.rb
334
334
  - tools/emoji4unicode.xml
335
- - tools/generate_au_emoticon_table.rb
336
- - tools/generate_docomo_emoticon_table.rb
337
335
  - tools/generate_emoticon_conversion_table.rb
338
- - tools/generate_softbank_emoticon_table.rb
339
336
  - tools/list_gps_unsupported_au.rb
340
337
  homepage: https://jpmobile-rails.org
341
338
  licenses:
@@ -352,14 +349,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
352
349
  requirements:
353
350
  - - ">="
354
351
  - !ruby/object:Gem::Version
355
- version: 2.7.0
352
+ version: 3.2.0
356
353
  required_rubygems_version: !ruby/object:Gem::Requirement
357
354
  requirements:
358
355
  - - ">="
359
356
  - !ruby/object:Gem::Version
360
357
  version: '0'
361
358
  requirements: []
362
- rubygems_version: 3.4.10
359
+ rubygems_version: 3.5.11
363
360
  signing_key:
364
361
  specification_version: 4
365
362
  summary: Rails plugin for mobile devices in Japan