ruby-changes:18273
From: tenderlove <ko1@a...>
Date: Thu, 23 Dec 2010 08:13:56 +0900 (JST)
Subject: [ruby-changes:18273] Ruby:r30296 (trunk): * lib/net/smtp.rb: refactoring Net::SMTP#esmtp= to use an
tenderlove 2010-12-23 08:13:49 +0900 (Thu, 23 Dec 2010) New Revision: 30296 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30296 Log: * lib/net/smtp.rb: refactoring Net::SMTP#esmtp= to use an attr_accessor Added files: trunk/test/net/smtp/test_smtp.rb Modified files: trunk/ChangeLog trunk/lib/net/smtp.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 30295) +++ ChangeLog (revision 30296) @@ -1,3 +1,8 @@ +Thu Dec 23 08:12:59 2010 Aaron Patterson <aaron@t...> + + * lib/net/smtp.rb: refactoring Net::SMTP#esmtp= to use an + attr_accessor + Thu Dec 23 06:35:41 2010 Aaron Patterson <aaron@t...> * lib/net/smtp.rb: Net::SMTP should close the SSL connection if the Index: lib/net/smtp.rb =================================================================== --- lib/net/smtp.rb (revision 30295) +++ lib/net/smtp.rb (revision 30296) @@ -229,11 +229,6 @@ "#<#{self.class} #{@address}:#{@port} started=#{@started}>" end - # +true+ if the SMTP object uses ESMTP (which it does by default). - def esmtp? - @esmtp - end - # # Set whether to use ESMTP or not. This should be done before # calling #start. Note that if #start is called in ESMTP mode, @@ -241,11 +236,10 @@ # object will automatically switch to plain SMTP mode and # retry (but not vice versa). # - def esmtp=(bool) - @esmtp = bool - end + attr_accessor :esmtp - alias esmtp esmtp? + # +true+ if the SMTP object uses ESMTP (which it does by default). + alias :esmtp? :esmtp # true if server advertises STARTTLS. # You cannot get valid value before opening SMTP session. Index: test/net/smtp/test_smtp.rb =================================================================== --- test/net/smtp/test_smtp.rb (revision 0) +++ test/net/smtp/test_smtp.rb (revision 30296) @@ -0,0 +1,16 @@ +require 'net/smtp' +require 'minitest/autorun' + +module Net + class TestSMTP < MiniTest::Unit::TestCase + def test_esmtp + smtp = Net::SMTP.new 'localhost', 25 + assert smtp.esmtp + assert smtp.esmtp? + + smtp.esmtp = 'omg' + assert_equal 'omg', smtp.esmtp + assert_equal 'omg', smtp.esmtp? + end + end +end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/