Преглед на файлове

Use keyword arguments for Net::IMAP.new

Akinori MUSHA преди 10 години
родител
ревизия
3ce41669b4
променени са 1 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. 3 3
      app/models/agents/imap_folder_agent.rb

+ 3 - 3
app/models/agents/imap_folder_agent.rb

@@ -322,7 +322,7 @@ module Agents
       port = (Integer(port) if port.present?)
       port = (Integer(port) if port.present?)
 
 
       log "Connecting to #{host}#{':%d' % port if port}#{' via SSL' if ssl}"
       log "Connecting to #{host}#{':%d' % port if port}#{' via SSL' if ssl}"
-      Client.open(host, port, ssl) { |imap|
+      Client.open(host, port: port, ssl: ssl) { |imap|
         log "Logging in as #{username}"
         log "Logging in as #{username}"
         imap.login(username, interpolated[:password])
         imap.login(username, interpolated[:password])
 
 
@@ -437,8 +437,8 @@ module Agents
 
 
     class Client < ::Net::IMAP
     class Client < ::Net::IMAP
       class << self
       class << self
-        def open(host, port, ssl)
+        def open(host, *args)
-          imap = new(host, port, ssl)
+          imap = new(host, *args)
           yield imap
           yield imap
         ensure
         ensure
           imap.disconnect unless imap.nil?
           imap.disconnect unless imap.nil?