Class: Lithium::Base

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/lithium/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



105
106
107
# File 'lib/lithium/base.rb', line 105

def env
  @env
end

#requestObject (readonly)

Returns the value of attribute request.



105
106
107
# File 'lib/lithium/base.rb', line 105

def request
  @request
end

#responseObject (readonly)

Returns the value of attribute response.



105
106
107
# File 'lib/lithium/base.rb', line 105

def response
  @response
end

Class Method Details

._newObject



69
# File 'lib/lithium/base.rb', line 69

alias :_new :new

.call(env) ⇒ Object



75
76
77
# File 'lib/lithium/base.rb', line 75

def call(env)
  new.call env
end

.filtersObject



83
84
85
# File 'lib/lithium/base.rb', line 83

def filters
 @filters ||= Hash.new
end

.new(*args, &block) ⇒ Object



70
71
72
73
# File 'lib/lithium/base.rb', line 70

def new(*args, &block)
  stack.run _new(*args, &block)
  stack
end

.routesObject



79
80
81
# File 'lib/lithium/base.rb', line 79

def routes
  @routes ||= Hash.new { |hash, key| hash[key] = [] }
end

.stackObject



87
88
89
# File 'lib/lithium/base.rb', line 87

def stack
  @stack ||= Rack::Builder.new
end

Instance Method Details

#call(env) ⇒ Object



107
108
109
# File 'lib/lithium/base.rb', line 107

def call(env)
  dup.call env
end

#halt(response) ⇒ Object



118
119
120
# File 'lib/lithium/base.rb', line 118

def halt(response)
  throw :halt, response
end

#sessionObject



122
123
124
# File 'lib/lithium/base.rb', line 122

def session
  request.env["rack.session"] || raise("Rack::Session handler is missing")
end