Class: Imap::Backup::Client::AutomaticLoginWrapper
- Inherits:
-
Object
- Object
- Imap::Backup::Client::AutomaticLoginWrapper
- Includes:
- RetryOnError
- Defined in:
- lib/imap/backup/client/automatic_login_wrapper.rb
Constant Summary collapse
- LOGIN_RETRY_CLASSES =
[::EOFError, ::Errno::ECONNRESET, ::SocketError].freeze
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#login_called ⇒ Object
readonly
Returns the value of attribute login_called.
Instance Method Summary collapse
-
#initialize(client:) ⇒ AutomaticLoginWrapper
constructor
A new instance of AutomaticLoginWrapper.
- #method_missing(method_name, *arguments, &block) ⇒ Object
- #respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
Methods included from RetryOnError
Constructor Details
#initialize(client:) ⇒ AutomaticLoginWrapper
Returns a new instance of AutomaticLoginWrapper.
16 17 18 19 |
# File 'lib/imap/backup/client/automatic_login_wrapper.rb', line 16 def initialize(client:) @client = client @login_called = false end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *arguments, &block) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/imap/backup/client/automatic_login_wrapper.rb', line 21 def method_missing(method_name, *arguments, &block) if login_called client.send(method_name, *arguments, &block) else do_first_login client.send(method_name, *arguments, &block) if method_name != :login end end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
13 14 15 |
# File 'lib/imap/backup/client/automatic_login_wrapper.rb', line 13 def client @client end |
#login_called ⇒ Object (readonly)
Returns the value of attribute login_called.
14 15 16 |
# File 'lib/imap/backup/client/automatic_login_wrapper.rb', line 14 def login_called @login_called end |
Instance Method Details
#respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
30 31 32 |
# File 'lib/imap/backup/client/automatic_login_wrapper.rb', line 30 def respond_to_missing?(method_name, _include_private = false) client.respond_to?(method_name) end |