Class: RemoteRuby::CacheAdapter
- Inherits:
-
ConnectionAdapter
- Object
- ConnectionAdapter
- RemoteRuby::CacheAdapter
- Defined in:
- lib/remote_ruby/cache_adapter.rb
Overview
An adapter which takes stdout, stderr and result streams from files and ignores all stdin. Only used to read from cache.
Instance Attribute Summary collapse
-
#connection_name ⇒ Object
readonly
Returns the value of attribute connection_name.
Instance Method Summary collapse
-
#initialize(cache_path:, connection_name:) ⇒ CacheAdapter
constructor
A new instance of CacheAdapter.
- #open(_code, _stdin, stdout, stderr) ⇒ Object
Constructor Details
#initialize(cache_path:, connection_name:) ⇒ CacheAdapter
Returns a new instance of CacheAdapter.
9 10 11 12 13 |
# File 'lib/remote_ruby/cache_adapter.rb', line 9 def initialize(cache_path:, connection_name:) super @cache_path = cache_path @connection_name = connection_name end |
Instance Attribute Details
#connection_name ⇒ Object (readonly)
Returns the value of attribute connection_name.
7 8 9 |
# File 'lib/remote_ruby/cache_adapter.rb', line 7 def connection_name @connection_name end |
Instance Method Details
#open(_code, _stdin, stdout, stderr) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/remote_ruby/cache_adapter.rb', line 15 def open(_code, _stdin, stdout, stderr) IO.copy_stream(stdout_file_path, stdout) IO.copy_stream(stderr_file_path, stderr) File.binread(result_file_path) if result_file_path end |