Class: HrLite::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/hr_lite/configuration.rb

Overview

All host integration points. Every attribute has a working default so the engine boots in any Rails app; a real host overrides what it needs in an initializer. See README for the full annotated example.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/hr_lite/configuration.rb', line 18

def initialize
  @user_class            = "User"
  @parent_controller     = "ActionController::Base"
  @current_user_method   = :current_user
  @authenticate_method   = :authenticate_user!
  @admin_check           = ->(user) { user.respond_to?(:admin?) && user.admin? }
  @display_name_method   = :display_name
  @employees_scope       = -> { HrLite.user_klass.all }
  @mentionable_users     = ->(query) { HrLite.default_mentionable_users(query) }
  @notify                = ->(user:, kind:, title:, body:, path:) { }
  @render_pdf            = nil
  @company               = -> { { name: "Company", address: nil, logo_path: nil } }
  @time_zone             = "Asia/Kolkata"
  @currency_symbol      = ""
  @on_designation_change = ->(user, designation) { }
  @leadership_emails     = []
  @leadership_check      = ->(user) do
    emails = HrLite.config.leadership_emails.map { |e| e.to_s.downcase.strip }
    emails.include?(user.email.to_s.downcase)
  end
  @extra_stylesheets     = [] # host stylesheets linked AFTER hr_lite.css (CSS-var overrides)
  @mailer_from           = "hr@example.com"
  @public_url_base       = nil # e.g. "https://hr.example.com" — enables email links + HrLite.public_url
  @notification_matrix   = nil # resolved lazily to Notifications::DEFAULT_MATRIX
  @back_link             = nil # optional {label:, url:} for the shell nav
end

Instance Attribute Details

#admin_checkObject

Returns the value of attribute admin_check.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def admin_check
  @admin_check
end

#authenticate_methodObject

Returns the value of attribute authenticate_method.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def authenticate_method
  @authenticate_method
end

Returns the value of attribute back_link.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def back_link
  @back_link
end

#companyObject

Returns the value of attribute company.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def company
  @company
end

#currency_symbolObject

Returns the value of attribute currency_symbol.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def currency_symbol
  @currency_symbol
end

#current_user_methodObject

Returns the value of attribute current_user_method.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def current_user_method
  @current_user_method
end

#display_name_methodObject

Returns the value of attribute display_name_method.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def display_name_method
  @display_name_method
end

#employees_scopeObject

Returns the value of attribute employees_scope.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def employees_scope
  @employees_scope
end

#extra_stylesheetsObject

Returns the value of attribute extra_stylesheets.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def extra_stylesheets
  @extra_stylesheets
end

#leadership_checkObject

Returns the value of attribute leadership_check.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def leadership_check
  @leadership_check
end

#leadership_emailsObject

Returns the value of attribute leadership_emails.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def leadership_emails
  @leadership_emails
end

#mailer_fromObject

Returns the value of attribute mailer_from.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def mailer_from
  @mailer_from
end

#mentionable_usersObject

Returns the value of attribute mentionable_users.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def mentionable_users
  @mentionable_users
end

#notification_matrixObject

Returns the value of attribute notification_matrix.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def notification_matrix
  @notification_matrix
end

#notifyObject

Returns the value of attribute notify.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def notify
  @notify
end

#on_designation_changeObject

Returns the value of attribute on_designation_change.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def on_designation_change
  @on_designation_change
end

#parent_controllerObject

Returns the value of attribute parent_controller.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def parent_controller
  @parent_controller
end

#public_url_baseObject Also known as: mail_link_base

Returns the value of attribute public_url_base.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def public_url_base
  @public_url_base
end

#render_pdfObject

Returns the value of attribute render_pdf.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def render_pdf
  @render_pdf
end

#time_zoneObject

Returns the value of attribute time_zone.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def time_zone
  @time_zone
end

#user_classObject

Returns the value of attribute user_class.



6
7
8
# File 'lib/hr_lite/configuration.rb', line 6

def user_class
  @user_class
end