Module: Rack::Webtranslateit

Extended by:
Webtranslateit
Included in:
Webtranslateit
Defined in:
lib/rack/webtranslateit.rb

Instance Method Summary collapse

Instance Method Details

#authenticator(username, password) ⇒ Object



15
16
17
# File 'lib/rack/webtranslateit.rb', line 15

def authenticator(username, password)
  username == "admin" and password == Configuration.password
end

#new(app, mount_point = "/translations/") ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/rack/webtranslateit.rb', line 4

def new(app, mount_point = "/translations/")
  authenticator = method(:authenticator)
  builder = Rack::Builder.new
  builder.map(mount_point) do
    use Rack::Auth::Basic, &authenticator if Configuration.password
    run Ui.new
  end
  builder.map("/"){ run app }
  builder.to_app
end