Class: Faas

Inherits:
Object
  • Object
show all
Defined in:
lib/faas.rb,
lib/faas/version.rb

Defined Under Namespace

Classes: Config, User

Constant Summary collapse

'faas_cookie'.freeze
VERSION =
'0.0.0'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.method_missing(symbol, *args, &block) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/faas.rb', line 28

def method_missing(symbol, *args, &block)
  if @faas.respond_to?(symbol)
    @faas.send(symbol, *args, &block)
  else
    super
  end
end

Instance Method Details

#configObject



16
17
18
19
20
21
22
23
# File 'lib/faas.rb', line 16

def config
  @config ||= Config.new # TODO: thread safety?
  if block_given?
    yield(@config)
  else
    @config
  end
end

#current_user(request) ⇒ Object



38
39
40
41
# File 'lib/faas.rb', line 38

def current_user(request)
  cookie = request.cookies[SESSION_COOKIE_NAME]
  cookie && !cookie.empty? && validate_cookie(cookie)
end