Module: HanamiId

Defined in:
lib/hanami_id.rb,
lib/hanami_id/version.rb,
lib/hanami_id/authentication.rb,
lib/hanami_id/warden/app_helper.rb

Defined Under Namespace

Modules: Authentication, Warden Classes: AuthError

Constant Summary collapse

MODES =
%w[standalone project].freeze
MODULES =
%w[sessions registrations].freeze
VERSION =
"0.2.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.app_nameObject

Returns the value of attribute app_name.



23
24
25
# File 'lib/hanami_id.rb', line 23

def app_name
  @app_name
end

.default_modulesObject

Returns the value of attribute default_modules.



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

def default_modules
  @default_modules
end

.failure_appObject

Returns the value of attribute failure_app.



24
25
26
# File 'lib/hanami_id.rb', line 24

def failure_app
  @failure_app
end

.loggerObject

Returns the value of attribute logger.



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

def logger
  @logger
end

.model_nameObject

Returns the value of attribute model_name.



22
23
24
# File 'lib/hanami_id.rb', line 22

def model_name
  @model_name
end

Class Method Details

.appObject



47
48
49
# File 'lib/hanami_id.rb', line 47

def app
  @app ||= Module.const_get(@app_name)
end

.classify(string) ⇒ Object



43
44
45
# File 'lib/hanami_id.rb', line 43

def classify(string)
  Hanami::Utils::String.classify string
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (HanamiId)

    the object that the method was called on



27
28
29
# File 'lib/hanami_id.rb', line 27

def configure
  yield self
end

.modelObject



31
32
33
# File 'lib/hanami_id.rb', line 31

def model
  @model ||= Module.const_get(classify(@model_name))
end

.repositoryObject



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

def repository
  @repository ||= Module.const_get("#{classify @model_name}Repository")
end

.repository_nameObject



35
36
37
# File 'lib/hanami_id.rb', line 35

def repository_name
  @repository_name ||= "#{@model_name}_repository"
end