Module: Virtuatable::Builders::Helpers::Controllers

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

Overview

Loading helpers to require and map all controllers classes inside a service. A controller is defined as a class inside de “Controllers” root module. If the module “Controllers” has not been defined, the list of controllers is always empty, as no controller can be loaded.

Author:

Instance Method Summary collapse

Instance Method Details

#controllersObject

Loads all of the controllers, given that the /controllers folder has already been fully required, therefore all constants are declared.



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

def controllers
  return [] if defined?(::Controllers).nil?

  classes = Controllers.constants.map { |symbol| get_const(symbol) }
  classes.select { |symbol| symbol.is_a? Class }
end