Module: Mumukit::Bridge::ResponseType

Defined in:
lib/mumukit/bridge/runner/response_type.rb

Defined Under Namespace

Classes: Base, Mixed, Structured, Unstructured

Class Method Summary collapse

Class Method Details

.for_response(response) ⇒ Object



87
88
89
90
91
92
93
94
95
# File 'lib/mumukit/bridge/runner/response_type.rb', line 87

def self.for_response(response)
  if mixed_test_results?(response)
    Mixed.new
  elsif structured_test_results?(response)
    Structured.new
  else
    Unstructured.new
  end
end

.mixed_test_results?(response) ⇒ Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/mumukit/bridge/runner/response_type.rb', line 83

def self.mixed_test_results?(response)
  structured_test_results?(response) && response['out'].present?
end

.structured_test_results?(response) ⇒ Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/mumukit/bridge/runner/response_type.rb', line 79

def self.structured_test_results?(response)
  response['testResults'].present?
end