Sha256: 79dbbd22b3d81c9dc622769a5dac40750525295fc136906d257fdcece1a8d840
Contents?: true
Size: 842 Bytes
Versions: 5
Compression:
Stored size: 842 Bytes
Contents
# frozen_string_literal: true module BaseEditingBootstrap ## # PORO to find the base classe in the BaseEditingController class ResourceFinder def initialize(controllar_path) @controllar_path = controllar_path @_model_class = false end # @return [NilClass|Object] def model if @_model_class === false @_model_class = nil if (anything = @controllar_path.singularize.camelize.safe_constantize) @_model_class = anything else if @controllar_path.include?("/") demodulize_one_level = @controllar_path.split("/")[1..].join("/") if demodulize_one_level != @controllar_path @_model_class = ResourceFinder.new(demodulize_one_level).model end end end end @_model_class end end end
Version data entries
5 entries across 5 versions & 1 rubygems