Class: Evalso::Response
- Inherits:
-
Object
- Object
- Evalso::Response
- Defined in:
- lib/evalso.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#compilation_result ⇒ Object
readonly
Returns the value of attribute compilation_result.
-
#output_files ⇒ Object
readonly
Returns the value of attribute output_files.
-
#remaining_evaluations ⇒ Object
readonly
Returns the value of attribute remaining_evaluations.
-
#return ⇒ Object
readonly
Returns the value of attribute return.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
-
#wall_time ⇒ Object
readonly
Returns the value of attribute wall_time.
Instance Method Summary collapse
- #handle_output_files(files) ⇒ Object
-
#initialize(code, hash) ⇒ Response
constructor
A new instance of Response.
- #inspect ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(code, hash) ⇒ Response
Returns a new instance of Response.
109 110 111 112 113 114 115 116 117 118 |
# File 'lib/evalso.rb', line 109 def initialize(code, hash) @code = code @stdout = hash["stdout"] @stderr = hash["stderr"] @return = hash["return"] @wall_time = hash["wallTime"] @exit_code = hash["exitCode"] @output_files = handle_output_files(hash["outputFiles"] || {}) @compilation_result = hash["compilationResult"] end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
106 107 108 |
# File 'lib/evalso.rb', line 106 def code @code end |
#compilation_result ⇒ Object (readonly)
Returns the value of attribute compilation_result.
106 107 108 |
# File 'lib/evalso.rb', line 106 def compilation_result @compilation_result end |
#output_files ⇒ Object (readonly)
Returns the value of attribute output_files.
106 107 108 |
# File 'lib/evalso.rb', line 106 def output_files @output_files end |
#remaining_evaluations ⇒ Object (readonly)
Returns the value of attribute remaining_evaluations.
106 107 108 |
# File 'lib/evalso.rb', line 106 def remaining_evaluations @remaining_evaluations end |
#return ⇒ Object (readonly)
Returns the value of attribute return.
106 107 108 |
# File 'lib/evalso.rb', line 106 def return @return end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
106 107 108 |
# File 'lib/evalso.rb', line 106 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
106 107 108 |
# File 'lib/evalso.rb', line 106 def stdout @stdout end |
#wall_time ⇒ Object (readonly)
Returns the value of attribute wall_time.
106 107 108 |
# File 'lib/evalso.rb', line 106 def wall_time @wall_time end |
Instance Method Details
#handle_output_files(files) ⇒ Object
120 121 122 123 124 |
# File 'lib/evalso.rb', line 120 def handle_output_files(files) files.keys.each do |file| files[file] = Base64.decode64(files[file]) end end |
#inspect ⇒ Object
126 127 128 |
# File 'lib/evalso.rb', line 126 def inspect "#<#{self.class.name} code=#{code.inspect} stdout=#{stdout.inspect} stderr=#{stderr.inspect} wall_time=#{wall_time.inspect}>" end |
#to_json ⇒ Object
130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/evalso.rb', line 130 def to_json { code: @code, stdout: @stdout, stderr: @stderr, return: @return, wall_time: @wall_time, exit_code: @exit_code, output_files: @output_files, compilation_result: @compilation_result, }.to_json end |