Class: RemoteRuby::EvalAdapter
- Inherits:
-
ConnectionAdapter
- Object
- ConnectionAdapter
- RemoteRuby::EvalAdapter
- Defined in:
- lib/remote_ruby/connection_adapter/eval_adapter.rb
Overview
An adapter to expecute Ruby code in the current process in an isolated scope
Instance Attribute Summary collapse
-
#async ⇒ Object
readonly
Returns the value of attribute async.
-
#working_dir ⇒ Object
readonly
Returns the value of attribute working_dir.
Instance Method Summary collapse
- #connection_name ⇒ Object
-
#initialize(working_dir: Dir.pwd, async: false) ⇒ EvalAdapter
constructor
A new instance of EvalAdapter.
- #open(code) ⇒ Object
Constructor Details
#initialize(working_dir: Dir.pwd, async: false) ⇒ EvalAdapter
Returns a new instance of EvalAdapter.
7 8 9 10 |
# File 'lib/remote_ruby/connection_adapter/eval_adapter.rb', line 7 def initialize(working_dir: Dir.pwd, async: false) @async = async @working_dir = working_dir end |
Instance Attribute Details
#async ⇒ Object (readonly)
Returns the value of attribute async.
5 6 7 |
# File 'lib/remote_ruby/connection_adapter/eval_adapter.rb', line 5 def async @async end |
#working_dir ⇒ Object (readonly)
Returns the value of attribute working_dir.
5 6 7 |
# File 'lib/remote_ruby/connection_adapter/eval_adapter.rb', line 5 def working_dir @working_dir end |
Instance Method Details
#connection_name ⇒ Object
12 13 14 |
# File 'lib/remote_ruby/connection_adapter/eval_adapter.rb', line 12 def connection_name '' end |
#open(code) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/remote_ruby/connection_adapter/eval_adapter.rb', line 16 def open(code) if async run_async(code) do |out, err| yield out, err end else run_sync(code) do |out, err| yield out, err end end end |