Module: MailCatcher::Web

Extended by:
Web
Included in:
Web
Defined in:
lib/mail_catcher/web.rb,
lib/mail_catcher/web/application.rb

Defined Under Namespace

Classes: Application

Instance Method Summary collapse

Instance Method Details

#appObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/mail_catcher/web.rb', line 9

def app
  @@app ||= Rack::Builder.new do
    map(MailCatcher.options[:http_path]) do
      if MailCatcher.development?
        require "mail_catcher/web/assets"
        map("/assets") { run Assets }
      end

      run Application
    end

    # This should only affect when http_path is anything but "/" above
    run lambda { |env| [302, {"Location" => MailCatcher.options[:http_path]}, []] }
  end
end

#call(env) ⇒ Object



25
26
27
# File 'lib/mail_catcher/web.rb', line 25

def call(env)
  app.call(env)
end