-
Notifications
You must be signed in to change notification settings - Fork 1
/
payroll.rb
52 lines (40 loc) · 1.15 KB
/
payroll.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
44
45
46
47
48
49
50
51
52
# frozen_string_literal: true
require 'rubygems'
require 'bundler/setup'
$payroll_environment ||= ENV['PAYROLL_ENVIRONMENT'] || :development
Bundler.require($payroll_environment, :default)
require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/object/try'
APP_ROOT = __dir__
class Payroll
attr_reader :loader
def initialize
@loader = Zeitwerk::Loader.new
loader.enable_reloading
loader.push_dir File.join(APP_ROOT, 'concepts')
loader.push_dir File.join(APP_ROOT, 'databases')
loader.collapse('concepts/common')
# A list of collapsing directories:
# --
# booking.rb -> Booking
# booking/actions/create.rb -> Booking::Create
# loader.collapse("booking/actions")
# loader.collapse("*/actions")
# Inflection Rules:
# --
# loader.inflector.inflect(
# "html_parser" => "HTMLParser",
# "mysql_adapter" => "MySQLAdapter"
# )
# Ignoring Files/Dirs:
# --
# loader.ignore(core_ext)
end
def init
loader.setup
end
delegate :reload, to: :loader
end
$payroll = Payroll.new
$payroll.init