Class: TrustedSandbox::HostRunner
- Inherits:
-
Object
- Object
- TrustedSandbox::HostRunner
- Defined in:
- lib/trusted_sandbox/host_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 = {}) ⇒ HostRunner
constructor
A new instance of HostRunner.
- #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 = {}) ⇒ HostRunner
Returns a new instance of HostRunner.
9 10 11 12 |
# File 'lib/trusted_sandbox/host_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/host_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/host_runner.rb', line 4 def uid_pool @uid_pool end |
Instance Method Details
#run(klass, *args) ⇒ Response
17 18 19 20 21 22 23 |
# File 'lib/trusted_sandbox/host_runner.rb', line 17 def run(klass, *args) if config.shortcut shortcut(klass, *args) else run_in_container(klass, *args) end end |
#run!(klass, *args) ⇒ Object
Return value from the #eval method
29 30 31 |
# File 'lib/trusted_sandbox/host_runner.rb', line 29 def run!(klass, *args) run(klass, *args).output! end |
#run_code(code, args = {}) ⇒ Response
36 37 38 |
# File 'lib/trusted_sandbox/host_runner.rb', line 36 def run_code(code, args={}) run(GeneralPurpose, code, args) end |
#run_code!(code, args = {}) ⇒ Object
Return value from the #eval method
44 45 46 |
# File 'lib/trusted_sandbox/host_runner.rb', line 44 def run_code!(code, args={}) run!(GeneralPurpose, code, args) end |