Class: TrustedSandbox::Runner
- Inherits:
-
Object
- Object
- TrustedSandbox::Runner
- Defined in:
- lib/trusted_sandbox/runner.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#uid_pool ⇒ Object
readonly
Returns the value of attribute uid_pool.
Instance Method Summary collapse
-
#initialize(config, uid_pool, config_override = {}) ⇒ Runner
constructor
A new instance of Runner.
- #run(klass, *args) ⇒ Response
-
#run!(klass, *args) ⇒ Object
Return value from the #eval method.
- #run_code(code, args = {}) ⇒ Response
-
#run_code!(code, args = {}) ⇒ Object
Return value from the #eval method.
Constructor Details
#initialize(config, uid_pool, config_override = {}) ⇒ Runner
Returns a new instance of Runner.
9 10 11 12 |
# File 'lib/trusted_sandbox/runner.rb', line 9 def initialize(config, uid_pool, config_override={}) @config = config.override(config_override) @uid_pool = uid_pool end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
4 5 6 |
# File 'lib/trusted_sandbox/runner.rb', line 4 def config @config end |
#uid_pool ⇒ Object (readonly)
Returns the value of attribute uid_pool.
4 5 6 |
# File 'lib/trusted_sandbox/runner.rb', line 4 def uid_pool @uid_pool end |
Instance Method Details
#run(klass, *args) ⇒ Response
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/trusted_sandbox/runner.rb', line 17 def run(klass, *args) create_code_dir serialize_request(klass, *args) create_container start_container ensure release_uid remove_code_dir remove_container end |
#run!(klass, *args) ⇒ Object
Return value from the #eval method
32 33 34 |
# File 'lib/trusted_sandbox/runner.rb', line 32 def run!(klass, *args) run(klass, *args).output! end |
#run_code(code, args = {}) ⇒ Response
39 40 41 |
# File 'lib/trusted_sandbox/runner.rb', line 39 def run_code(code, args={}) run(GeneralPurpose, code, args) end |
#run_code!(code, args = {}) ⇒ Object
Return value from the #eval method
47 48 49 |
# File 'lib/trusted_sandbox/runner.rb', line 47 def run_code!(code, args={}) run!(GeneralPurpose, code, args) end |