Class: Constant::Controls::Script::Example
- Inherits:
-
Object
- Object
- Constant::Controls::Script::Example
- Includes:
- Initializer
- Defined in:
- lib/constant/controls/script.rb
Instance Method Summary collapse
Instance Method Details
#error ⇒ Object
85 86 87 88 89 90 91 92 93 |
# File 'lib/constant/controls/script.rb', line 85 def error _, error_output, status = execute if status.success? raise "Script succeeded\n\n#{source}" end error_output end |
#execute ⇒ Object
95 96 97 98 99 100 101 102 103 |
# File 'lib/constant/controls/script.rb', line 95 def execute = $LOAD_PATH.map do |load_path_entry| "-I#{load_path_entry}" end command = ["ruby", *, "-e", source] Open3.capture3(*command) end |
#run ⇒ Object
75 76 77 78 79 80 81 82 83 |
# File 'lib/constant/controls/script.rb', line 75 def run output, error_output, status = execute if not status.success? raise "Script failed\n\n#{source}\n#{error_output}" end output.split("\n") end |