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.
5 6 7 8 |
# File 'lib/remote_ruby/connection_adapter/cache_adapter.rb', line 5 def initialize(connection_name:, cache_path:) @cache_path = cache_path @connection_name = connection_name end |
Instance Method Details
#connection_name ⇒ Object
10 11 12 |
# File 'lib/remote_ruby/connection_adapter/cache_adapter.rb', line 10 def connection_name "[CACHE] #{@connection_name}" end |
#open(_code) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/remote_ruby/connection_adapter/cache_adapter.rb', line 14 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 |