Class: CodeCube::Response
- Inherits:
-
Object
- Object
- CodeCube::Response
- Defined in:
- lib/codecube/response.rb
Instance Method Summary collapse
- #duration ⇒ Object
-
#initialize(data) ⇒ Response
constructor
A new instance of Response.
- #output ⇒ Object
- #text_output ⇒ Object
- #timed_out? ⇒ Boolean
Constructor Details
#initialize(data) ⇒ Response
Returns a new instance of Response.
3 4 5 |
# File 'lib/codecube/response.rb', line 3 def initialize(data) @data = data end |
Instance Method Details
#duration ⇒ Object
7 8 9 |
# File 'lib/codecube/response.rb', line 7 def duration @data["duration_ms"] end |
#output ⇒ Object
15 16 17 |
# File 'lib/codecube/response.rb', line 15 def output @data["output"] end |
#text_output ⇒ Object
19 20 21 22 23 |
# File 'lib/codecube/response.rb', line 19 def text_output @data["output"].select { |l| %w(stdout stderr).include?(l["stream"]) } .map { |l| l["body"] } .join("\n") end |
#timed_out? ⇒ Boolean
11 12 13 |
# File 'lib/codecube/response.rb', line 11 def timed_out? @data["timed_out"] end |