Class: Ixtlan::ChildPath

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

Instance Method Summary collapse

Constructor Details

#initialize(app, rootpath) ⇒ ChildPath

Returns a new instance of ChildPath.



3
4
5
6
# File 'lib/ixtlan/child_path.rb', line 3

def initialize(app, rootpath)
  @app = app
  @rootpath = rootpath
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/ixtlan/child_path.rb', line 8

def call(env)
  ['REQUEST_PATH','PATH_INFO','REQUEST_URI','SCRIPT_NAME'].each do |key|
    if(env[key] =~ /[.]xml([?].*)?$/)
      env[key].gsub!(/^\/#{@rootpath}/, "")
    end
  end
  @app.call(env)
end