Class: Rack::MogileFS

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/mogilefs.rb,
lib/rack/mogilefs/version.rb,
lib/rack/mogilefs/endpoint.rb,
lib/rack/mogilefs/endpoint/base.rb,
lib/rack/mogilefs/endpoint/client.rb,
lib/rack/mogilefs/endpoint/mapper.rb,
lib/rack/mogilefs/endpoint/caching.rb,
lib/rack/mogilefs/endpoint/reproxy.rb,
lib/rack/mogilefs/endpoint/rescues.rb

Defined Under Namespace

Classes: Endpoint

Constant Summary collapse

VERSION =
"0.3.2"

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ MogileFS

Returns a new instance of MogileFS.



10
11
12
# File 'lib/rack/mogilefs.rb', line 10

def initialize(app, options={})
  @app, @options = app, options
end

Instance Method Details

#call(env) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/rack/mogilefs.rb', line 14

def call(env)
  if env['PATH_INFO'] =~ @options[:path]
    endpoint.call(env)
  else
    @app.call(env)
  end
end

#endpointObject



22
23
24
# File 'lib/rack/mogilefs.rb', line 22

def endpoint
  @endpoint ||= Endpoint.new(@options)
end