Class: Rack::Transform::Transformers::Base::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/transform/transformers/base.rb

Constant Summary collapse

CONTENT_LENGTH =
"Content-Length".freeze
CONTENT_TYPE =
"Content-Type".freeze
JSON_TYPE =
"application/json".freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, header, body) ⇒ Response



63
64
65
66
67
# File 'lib/rack/transform/transformers/base.rb', line 63

def initialize(status, header, body)
  @status = status
  @header = header.merge CONTENT_TYPE => JSON_TYPE
  @body = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



61
62
63
# File 'lib/rack/transform/transformers/base.rb', line 61

def body
  @body
end

#headerObject (readonly)

Returns the value of attribute header.



61
62
63
# File 'lib/rack/transform/transformers/base.rb', line 61

def header
  @header
end

#statusObject (readonly)

Returns the value of attribute status.



61
62
63
# File 'lib/rack/transform/transformers/base.rb', line 61

def status
  @status
end

Class Method Details

.call(status, header, body) ⇒ Object



57
58
59
# File 'lib/rack/transform/transformers/base.rb', line 57

def self.call(status, header, body)
  new(status, header, body).process
end

Instance Method Details

#processObject

Raises:

  • (NotImplementedError)


69
70
71
# File 'lib/rack/transform/transformers/base.rb', line 69

def process
  raise NotImplementedError
end