Class: RestCore::DefaultSite

Inherits:
Object
  • Object
show all
Includes:
Middleware
Defined in:
lib/rest-core/middleware/default_site.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.membersObject



4
# File 'lib/rest-core/middleware/default_site.rb', line 4

def self.members; [:site]; end

Instance Method Details

#call(env, &k) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/rest-core/middleware/default_site.rb', line 7

def call env, &k
  path = if env[REQUEST_PATH].to_s.include?('://')
           env[REQUEST_PATH]
         else
           File.join(site(env).to_s, env[REQUEST_PATH].to_s)
         end

  app.call(env.merge(REQUEST_PATH => path), &k)
end