Class: Rivulet::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/rivulet/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ Request

Returns a new instance of Request.



5
6
7
8
9
10
11
12
# File 'lib/rivulet/request.rb', line 5

def initialize(env)
  @http_method  = env['REQUEST_METHOD'].downcase.to_sym
  @path         = env['PATH_INFO']
  @content_type = env['CONTENT_TYPE']
  @body         = env['rack.input']
  @session      = env['rack.session']
  @env          = env
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



3
4
5
# File 'lib/rivulet/request.rb', line 3

def body
  @body
end

#content_typeObject (readonly)

Returns the value of attribute content_type.



3
4
5
# File 'lib/rivulet/request.rb', line 3

def content_type
  @content_type
end

#envObject (readonly)

Returns the value of attribute env.



3
4
5
# File 'lib/rivulet/request.rb', line 3

def env
  @env
end

#http_methodObject (readonly)

Returns the value of attribute http_method.



3
4
5
# File 'lib/rivulet/request.rb', line 3

def http_method
  @http_method
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/rivulet/request.rb', line 3

def path
  @path
end

#sessionObject (readonly)

Returns the value of attribute session.



3
4
5
# File 'lib/rivulet/request.rb', line 3

def session
  @session
end

Instance Method Details

#cookiesObject



14
15
16
# File 'lib/rivulet/request.rb', line 14

def cookies
  Rack::Utils.parse_cookies(env)
end