Module: RJSV::Core::Constants

Defined in:
lib/rjsv/core/constants.rb

Overview

The module is reserved for handling classes and modules. Thus, it is a manipulation of constant keywords.

Class Method Summary collapse

Class Method Details

.get_classes(mod) ⇒ Object

This method tries to find already initialized classes from the mod (module) using the abstract class RJSV::Plugin. It returns an array of classes.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rjsv/core/constants.rb', line 15

def get_classes(mod)
  mod.constants.map do |c|
    const = mod.const_get(c)

    if const.is_a?(Class) &&
        const.superclass.name == 'RJSV::Plugin'
      const
    elsif const.is_a? Module
      get_classes(const)
    else
      next
    end
  end.flatten.compact
end