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, &block) ⇒ Object
Constructor Details
#initialize(working_dir: Dir.pwd, async: false) ⇒ EvalAdapter
Returns a new instance of EvalAdapter.
9 10 11 12 13 |
# File 'lib/remote_ruby/connection_adapter/eval_adapter.rb', line 9 def initialize(working_dir: Dir.pwd, async: false) super @async = async @working_dir = working_dir end |
Instance Attribute Details
#async ⇒ Object (readonly)
Returns the value of attribute async.
7 8 9 |
# File 'lib/remote_ruby/connection_adapter/eval_adapter.rb', line 7 def async @async end |
#working_dir ⇒ Object (readonly)
Returns the value of attribute working_dir.
7 8 9 |
# File 'lib/remote_ruby/connection_adapter/eval_adapter.rb', line 7 def working_dir @working_dir end |
Instance Method Details
#connection_name ⇒ Object
15 16 17 |
# File 'lib/remote_ruby/connection_adapter/eval_adapter.rb', line 15 def connection_name '' end |
#open(code, &block) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/remote_ruby/connection_adapter/eval_adapter.rb', line 19 def open(code, &block) if async run_async(code, &block) else run_sync(code, &block) end end |