Class: BetterAuth::Auth

Inherits:
Object
  • Object
show all
Defined in:
lib/better_auth/auth.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Auth

Returns a new instance of Auth.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/better_auth/auth.rb', line 7

def initialize(options = {})
  @options = Configuration.new(options)
  @context = Context.new(@options)
  @context.set_adapter(build_adapter)
  @context.set_internal_adapter(Adapters::InternalAdapter.new(@context.adapter, @options))
  @plugin_registry = PluginRegistry.new(@context)
  @plugin_registry.run_init!
  @error_codes = build_error_codes
  @endpoints = build_endpoints
  Router.check_endpoint_conflicts(@options, @options.logger)
  @api = API.new(@context, @endpoints)
  @handler = Router.new(@context, @endpoints)
end

Instance Attribute Details

#apiObject (readonly)

Returns the value of attribute api.



5
6
7
# File 'lib/better_auth/auth.rb', line 5

def api
  @api
end

#contextObject (readonly)

Returns the value of attribute context.



5
6
7
# File 'lib/better_auth/auth.rb', line 5

def context
  @context
end

#error_codesObject (readonly)

Returns the value of attribute error_codes.



5
6
7
# File 'lib/better_auth/auth.rb', line 5

def error_codes
  @error_codes
end

#handlerObject (readonly)

Returns the value of attribute handler.



5
6
7
# File 'lib/better_auth/auth.rb', line 5

def handler
  @handler
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/better_auth/auth.rb', line 5

def options
  @options
end

Instance Method Details

#call(env) ⇒ Object



21
22
23
# File 'lib/better_auth/auth.rb', line 21

def call(env)
  handler.call(env)
end