Class: NYNY::Response

Inherits:
Rack::Response
  • Object
show all
Defined in:
lib/nyny/primitives.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body = [], status = 200, header = {}) ⇒ Response

Returns a new instance of Response.



8
9
10
11
# File 'lib/nyny/primitives.rb', line 8

def initialize body=[], status=200, header={}
  @raw_body = body
  super body.to_s, status, header
end

Instance Attribute Details

#raw_bodyObject (readonly)

Returns the value of attribute raw_body.



6
7
8
# File 'lib/nyny/primitives.rb', line 6

def raw_body
  @raw_body
end

Instance Method Details

#body=(value) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/nyny/primitives.rb', line 13

def body= value
  @raw_body = value
  @body = []
  @length = 0

  if value.respond_to? :to_str
    write value.to_str
  elsif value.respond_to?(:each)
    value.each {|part| write part.to_s }
  end
end