diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb index 13e1f1f..639c01e 100644 --- a/lib/net/smtp.rb +++ b/lib/net/smtp.rb @@ -1152,6 +1152,7 @@ def initialize(address, *args, **kw_args) def to_s @address end + alias to_str to_s end end # class SMTP diff --git a/test/net/smtp/test_smtp.rb b/test/net/smtp/test_smtp.rb index 9a0ac53..2e29719 100644 --- a/test/net/smtp/test_smtp.rb +++ b/test/net/smtp/test_smtp.rb @@ -102,6 +102,8 @@ def test_rcptto_with_address def test_address a = Net::SMTP::Address.new('foo@example.com', 'p0=123', {p1: 456}, p2: nil, p3: '789') assert_equal 'foo@example.com', a.address + assert_equal '', "<#{a}>" # Address#to_s + assert_match(/\Afoo@example\.com\z/, a) # Address#to_str assert_equal ['p0=123', 'p1=456', 'p2', 'p3=789'], a.parameters end