Class: RackP

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

Constant Summary collapse

VERSION =
'0.1.2'

Instance Method Summary collapse

Constructor Details

#initializeRackP

Returns a new instance of RackP.



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

def initialize
  @stack=[]
end

Instance Method Details

#run(middleware, env = ENV.to_h) ⇒ Object



9
10
11
# File 'lib/rackp.rb', line 9

def run middleware, env = ENV.to_h
  @stack.inject(middleware) { |m, o| o.new(m) }.call(env)
end

#use(middleware) ⇒ Object



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

def use middleware
  @stack.unshift middleware
end