Class: RailsAppGenerator::AddonUtil

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_app_generator/addon_util.rb

Overview

Utility methods for accessing Addons

Class Method Summary collapse

Class Method Details

.classesObject

Get the Addon classes that are stored in the RailsAppGenerator::Addons::* namespace



8
9
10
11
12
# File 'lib/rails_app_generator/addon_util.rb', line 8

def classes
  AddOns.constants
        .map { |addon_klass_name| AddOns.const_get(addon_klass_name) }
        .select { |klass| klass.ancestors.include?(RailsAppGenerator::Addon) }
end

.get(addon) ⇒ Object

Convert a string to a symbol to a fully qualified class constant



15
16
17
18
# File 'lib/rails_app_generator/addon_util.rb', line 15

def get(addon)
  addon = addon.to_s.capitalize.camelize
  "RailsAppGenerator::AddOns::#{addon}".constantize
end