Class: Rubel::Runtime::Sandbox
Overview
Sandbox is the default runtime for production environments. It has some basic protection against ruby code injection.
Sandbox is a BasicObject so it lives outside the default namespace. To access outside classes and modules you are forced to use “::” as namespace.
Instance Method Summary collapse
-
#lambda(&block) ⇒ Object
make -> {} and lambda {} work when included as BasicObject.
- #puts(str) ⇒ Object
- #sanitize!(string) ⇒ Object
Methods included from Core
#execute, #method_missing, #sanitized_proc
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Rubel::Core
Instance Method Details
#lambda(&block) ⇒ Object
make -> {} and lambda {} work when included as BasicObject
47 48 49 |
# File 'lib/rubel/runtime/sandbox.rb', line 47 def lambda(&block) ::Kernel.lambda(&block) end |
#puts(str) ⇒ Object
51 52 53 |
# File 'lib/rubel/runtime/sandbox.rb', line 51 def puts(str) ::Kernel.puts(str) end |
#sanitize!(string) ⇒ Object
55 56 57 |
# File 'lib/rubel/runtime/sandbox.rb', line 55 def sanitize!(string) string.gsub!('::', '') end |