Class: Mona::Loaders::Base

Inherits:
Object
  • Object
show all
Includes:
SetupDsl, Mixins
Defined in:
lib/mona/loaders/base.rb

Direct Known Subclasses

Zeitwerk

Defined Under Namespace

Modules: SetupDsl

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SetupDsl

#ignore, #inflect, #overwrite

Methods included from Mixins

included

Constructor Details

#initialize(root_path, &block) ⇒ Base

Returns a new instance of Base.



18
19
20
21
22
23
24
25
26
# File 'lib/mona/loaders/base.rb', line 18

def initialize(root_path, &block)
  @root_path = root_path
  @overwriters = []
  @inflections = {}
  @ignore_dirs = []
  @autoload_dirs = []

  instance_exec(&block) if block_given?
end

Instance Attribute Details

#autoload_dirsObject (readonly)

Returns the value of attribute autoload_dirs.



16
17
18
# File 'lib/mona/loaders/base.rb', line 16

def autoload_dirs
  @autoload_dirs
end

#ignore_dirsObject (readonly)

Returns the value of attribute ignore_dirs.



16
17
18
# File 'lib/mona/loaders/base.rb', line 16

def ignore_dirs
  @ignore_dirs
end

#inflectionsObject (readonly)

Returns the value of attribute inflections.



16
17
18
# File 'lib/mona/loaders/base.rb', line 16

def inflections
  @inflections
end

#loaderObject (readonly)

Returns the value of attribute loader.



16
17
18
# File 'lib/mona/loaders/base.rb', line 16

def loader
  @loader
end

#overwritersObject (readonly)

Returns the value of attribute overwriters.



16
17
18
# File 'lib/mona/loaders/base.rb', line 16

def overwriters
  @overwriters
end

#root_pathObject (readonly)

Returns the value of attribute root_path.



16
17
18
# File 'lib/mona/loaders/base.rb', line 16

def root_path
  @root_path
end

Class Method Details

.inherited(subclass) ⇒ Object



9
10
11
12
13
# File 'lib/mona/loaders/base.rb', line 9

def inherited(subclass)
  name = subclass.to_s.split("::").last.downcase.to_sym

  registry[name] = subclass
end

.registryObject



5
6
7
# File 'lib/mona/loaders/base.rb', line 5

def registry
  @registry ||= {}
end

Instance Method Details

#check_classesObject

Raises:

  • (StandardError)


44
45
46
# File 'lib/mona/loaders/base.rb', line 44

def check_classes
  raise StandardError.new('not implemented')
end

#eager_loadObject

Raises:

  • (StandardError)


40
41
42
# File 'lib/mona/loaders/base.rb', line 40

def eager_load
  raise StandardError.new('not implemented')
end

#push_dir(dir) ⇒ Object



28
29
30
# File 'lib/mona/loaders/base.rb', line 28

def push_dir(dir)
  @autoload_dirs.push(dir)
end

#reloadObject

Raises:

  • (StandardError)


36
37
38
# File 'lib/mona/loaders/base.rb', line 36

def reload
  raise StandardError.new('not implemented')
end

#setupObject

Raises:

  • (StandardError)


32
33
34
# File 'lib/mona/loaders/base.rb', line 32

def setup
  raise StandardError.new('not implemented')
end