class Rumblelog

Public Instance Methods

authorized?() click to toggle source
# File rumblelog.rb, line 36
def authorized?
  @auth ||=  Rack::Auth::Basic::Request.new(request.env)

  @auth.provided? &&
    @auth.basic? &&
    @auth.credentials &&
    @auth.credentials == ['admin', 'admin']
end
protected!() click to toggle source
# File rumblelog.rb, line 30
def protected!
  return if authorized?
  headers['WWW-Authenticate'] = 'Basic realm="Restricted Area"'
  halt 401, "Not authorized\n"
end
with_context(&block) click to toggle source
# File rumblelog.rb, line 47
def with_context(&block)
  if block.nil?
    raise "with_context called without block"
  elsif Fauna.connection.nil?
    raise "cannot use Fauna::Client.context without connection"
  else
    Fauna::Client.context(Fauna.connection) do
      block.call
    end
  end
end