Class: RemoteRuby::CacheAdapter
- Inherits:
-
ConnectionAdapter
- Object
- ConnectionAdapter
- RemoteRuby::CacheAdapter
- Defined in:
- lib/remote_ruby/connection_adapter/cache_adapter.rb
Overview
An adapter which takes stdout and stderr from files and ignores all stdin. Only used to read from cache.
Instance Method Summary collapse
- #connection_name ⇒ Object
-
#initialize(connection_name:, cache_path:) ⇒ CacheAdapter
constructor
A new instance of CacheAdapter.
- #open(_code) ⇒ Object
Constructor Details
#initialize(connection_name:, cache_path:) ⇒ CacheAdapter
Returns a new instance of CacheAdapter.
7 8 9 10 11 |
# File 'lib/remote_ruby/connection_adapter/cache_adapter.rb', line 7 def initialize(connection_name:, cache_path:) super @cache_path = cache_path @connection_name = connection_name end |
Instance Method Details
#connection_name ⇒ Object
13 14 15 |
# File 'lib/remote_ruby/connection_adapter/cache_adapter.rb', line 13 def connection_name "[CACHE] #{@connection_name}" end |
#open(_code) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/remote_ruby/connection_adapter/cache_adapter.rb', line 17 def open(_code) stdout = File.open(stdout_file_path, 'r') stderr = File.open(stderr_file_path, 'r') yield stdout, stderr ensure stderr.close unless stderr.closed? stdout.close unless stdout.closed? end |