Module: Lifer::Shared::FinderMethods::ClassMethods

Defined in:
lib/lifer/shared/finder_methods.rb

Overview

This module contains the class methods to be included in other classes.

Instance Method Summary collapse

Instance Method Details

#find(name) ⇒ Class

A simple finder.

Parameters:

  • name (string)

    The configured name of the builder you want to find.

Returns:

  • (Class)

    A builder class.



23
24
25
26
27
28
29
30
31
32
# File 'lib/lifer/shared/finder_methods.rb', line 23

def find(name)
  result = subclasses.detect { |klass| klass.name == name.to_sym }

  if result.nil?
    raise StandardError, I18n.t("shared.finder_methods.unknown_class", name:)
    return
  end

  result
end