Module: Virtuatable::Builders::Helpers::Loaders

Included in:
Base
Defined in:
lib/virtuatable/builders/helpers/loaders.rb

Overview

Add the methods to declare an array of loaders into a builder class.

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#loadersArray

Returns an array of loading functions invoked at startup.

Returns:

  • (Array)

    an array of loading functions invoked at startup.



11
12
13
# File 'lib/virtuatable/builders/helpers/loaders.rb', line 11

def loaders
  @loaders
end

Instance Method Details

#declare_loader(loader, priority:) ⇒ Object

Declares a loader in the current builder class.

Parameters:

  • loader (Symbol)

    the name of the loader, infered as the method name to call.



15
16
17
18
# File 'lib/virtuatable/builders/helpers/loaders.rb', line 15

def declare_loader(loader, priority:)
  loader_h = { name: loader.to_sym, priority: priority }
  @loaders.nil? ? @loaders = [loader_h] : @loaders << loader_h
end