我在访问某些变量的内容时遇到问题。我正在使用Mail gem并具有以下代码:
class Email
attr_accessor :server, :port, :username, :password, :ssl
def check_mail
# puts server ---> imap.googlemail.com ---> work
Mail.defaults do
# puts server ---> nil ---> not work
retriever_method :imap, address: server, #---> obviously not work
port: port,
user_name: username,
password: password,
enable_ssl: ssl
end
end
end
def account
acc = Email.new
acc.server = 'imap.googlemail.com'
acc.port = '993'
acc.username = 'xxx'
acc.password = 'xxx'
acc.ssl = 'true'
acc.check_mail
end
我无法从内部访问变量Mail.default do
,我想这将是一个类问题。