class Godmin::Resolver

Public Class Methods

new(path, controller_path, engine_wrapper) click to toggle source
Calls superclass method
# File lib/godmin/resolver.rb, line 13
def initialize(path, controller_path, engine_wrapper)
  super(path)
  @controller_path = controller_path
  @engine_wrapper = engine_wrapper
end
resolvers(controller_path, engine_wrapper) click to toggle source
# File lib/godmin/resolver.rb, line 6
def self.resolvers(controller_path, engine_wrapper)
  [
    EngineResolver.new(controller_path, engine_wrapper),
    GodminResolver.new(controller_path, engine_wrapper)
  ]
end

Public Instance Methods

_find_all(name, prefix, partial, details, key, locals) click to toggle source

This function is for Rails 6 and up since the ‘find_templates` function is deprecated. It does the same thing, just a little differently. It’s not being run by versions previous to Rails 6.

# File lib/godmin/resolver.rb, line 22
def _find_all(name, prefix, partial, details, key, locals)
  templates = []

  template_paths(prefix).each do |p|
    break if templates.present?

    path = Path.build(name, "#{@path}/#{p}", partial)
    templates = query(path, details, details[:formats], locals, cache: !!key)
  end

  templates
end
find_templates(name, prefix, *args) click to toggle source

This is how we find templates in Rails 5 and below.

Calls superclass method
# File lib/godmin/resolver.rb, line 36
def find_templates(name, prefix, *args)
  templates = []

  template_paths(prefix).each do |path|
    break if templates.present?

    templates = super(name, path, *args)
  end

  templates
end