Sha256: e30f0863c9519e9003f3d6849021a358c6ccd7ad9affe71177876e672d9d7bbd

Contents?: true

Size: 368 Bytes

Versions: 2

Compression:

Stored size: 368 Bytes

Contents

module Resty
  class ChildPath
    def initialize(app, rootpath)
      @app = app
      @rootpath = rootpath
    end

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

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
resty-generators-0.2.0 lib/resty/child_path.rb
resty-generators-0.1.0 lib/resty/child_path.rb