[前][次][番号順一覧][スレッド一覧]

ruby-changes:44769

From: shugo <ko1@a...>
Date: Sat, 19 Nov 2016 16:02:36 +0900 (JST)
Subject: [ruby-changes:44769] shugo:r56842 (trunk): Expand abbreviated option names.

shugo	2016-11-19 16:02:32 +0900 (Sat, 19 Nov 2016)

  New Revision: 56842

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56842

  Log:
    Expand abbreviated option names.

  Modified files:
    trunk/lib/net/ftp.rb
    trunk/test/net/ftp/test_ftp.rb
Index: lib/net/ftp.rb
===================================================================
--- lib/net/ftp.rb	(revision 56841)
+++ lib/net/ftp.rb	(revision 56842)
@@ -174,20 +174,22 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L174
     #
     # The available options are:
     #
-    # port::    Port number (default value is 21)
-    # ssl::     If options[:ssl] is true, then an attempt will be made
-    #           to use SSL (now TLS) to connect to the server.  For this to
-    #           work OpenSSL [OSSL] and the Ruby OpenSSL [RSSL] extensions
-    #           need to be installed.  If options[:ssl] is a hash, it's
-    #           passed to OpenSSL::SSL::SSLContext#set_params as parameters.
+    # port::      Port number (default value is 21)
+    # ssl::       If options[:ssl] is true, then an attempt will be made
+    #             to use SSL (now TLS) to connect to the server.  For this
+    #             to work OpenSSL [OSSL] and the Ruby OpenSSL [RSSL]
+    #             extensions need to be installed.  If options[:ssl] is a
+    #             hash, it's passed to OpenSSL::SSL::SSLContext#set_params
+    #             as parameters.
     # private_data_connection::  If true, TLS is used for data connections.
     #                            Default: +true+ when options[:ssl] is true.
-    # user::    Username for login.  If options[:user] is the string
-    #           "anonymous" and the options[:password] is +nil+,
-    #           "anonymous@" is used as a password.
-    # passwd::  Password for login.
-    # acct::    Account information for ACCT.
-    # passive:: When +true+, the connection is in passive mode. Default: +true+.
+    # username::  Username for login.  If options[:user] is the string
+    #             "anonymous" and the options[:password] is +nil+,
+    #             "anonymous@" is used as a password.
+    # password::  Password for login.
+    # account::   Account information for ACCT.
+    # passive::   When +true+, the connection is in passive mode. Default:
+    #             +true+.
     # debug_mode::  When +true+, all traffic to and from the server is
     #               written to +$stdout+.  Default: +false+.
     #
@@ -198,9 +200,9 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L200
       rescue NoMethodError
         # for backward compatibility
         options = {}
-        options[:user] = user_or_options
-        options[:passwd] = passwd
-        options[:acct] = acct
+        options[:username] = user_or_options
+        options[:password] = passwd
+        options[:account] = acct
       end
       @host = nil
       if options[:ssl]
@@ -250,8 +252,8 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L252
           # the number of arguments passed to connect....
           connect(host)
         end
-        if options[:user]
-          login(options[:user], options[:passwd], options[:acct])
+        if options[:username]
+          login(options[:username], options[:password], options[:account])
         end
       end
     end
Index: test/net/ftp/test_ftp.rb
===================================================================
--- test/net/ftp/test_ftp.rb	(revision 56841)
+++ test/net/ftp/test_ftp.rb	(revision 56842)
@@ -239,9 +239,9 @@ class FTPTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L239
       begin
         ftp = Net::FTP.new(SERVER_ADDR,
                            port: server.port,
-                           user: "foo",
-                           passwd: "bar",
-                           acct: "baz")
+                           username: "foo",
+                           password: "bar",
+                           account: "baz")
         assert_equal("USER foo\r\n", commands.shift)
         assert_equal("PASS bar\r\n", commands.shift)
         assert_equal("ACCT baz\r\n", commands.shift)
@@ -267,7 +267,7 @@ class FTPTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L267
       sock.print("200 Switching to Binary mode.\r\n")
     }
     begin
-      Net::FTP.open(SERVER_ADDR, port: server.port, user: "anonymous") do
+      Net::FTP.open(SERVER_ADDR, port: server.port, username: "anonymous") do
       end
       assert_equal("USER anonymous\r\n", commands.shift)
       assert_equal("PASS anonymous@\r\n", commands.shift)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]