Class: Riddl::Server::Execution

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby/riddl/server.rb

Overview

{{{

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, headers) ⇒ Execution

Returns a new instance of Execution.



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/ruby/riddl/server.rb', line 29

def initialize(response,headers)
  @response = (response.is_a?(Array) ? response.dup : [response])
  @headers  = (headers.is_a?(Array) ? headers : [headers])
  @response.delete_if do |r|
    r.class != Riddl::Parameter::Simple && r.class != Riddl::Parameter::Complex
  end
  @headers.delete_if do |h|
    h.class != Riddl::Header
  end
  @headers.compact!
  @response.compact!
  @headers = Hash[ @headers.map{ |h| [h.name, h.value] } ]
end

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



28
29
30
# File 'lib/ruby/riddl/server.rb', line 28

def headers
  @headers
end

#responseObject (readonly)

Returns the value of attribute response.



28
29
30
# File 'lib/ruby/riddl/server.rb', line 28

def response
  @response
end