Class: Lotus::Model::Adapters::DisconnectedResource Private

Inherits:
Utils::BasicObject
Defined in:
lib/lotus/model/adapters/abstract.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Represents a disconnected resource.

When we use #disconnect for MemoryAdapter and </tt>FileSystemAdapter</tt>, we want to free underlying resources such as a mutex or a file descriptor.

These adapters use to use anonymous descriptors that are destroyed by Ruby VM after each operation. Sometimes we need to clean the state and start fresh (eg. during a test suite or a deploy).

Instead of assign nil to these instance variables, we assign this special type: DisconnectedResource.

In case an operation is still performed after the adapter was disconnected, instead of see a generic NoMethodError for nil, a developer will face a specific message relative to the state of the adapter.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.5.0



62
63
64
# File 'lib/lotus/model/adapters/abstract.rb', line 62

def method_missing(method_name, *)
  ::Kernel.raise DisconnectedAdapterError.new
end