Class: Superglue::Resolver

Inherits:
ActionView::FileSystemResolver
  • Object
show all
Defined in:
lib/superglue/resolver.rb

Defined Under Namespace

Classes: JsxPathParser

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Resolver

Returns a new instance of Resolver.

Raises:

  • (ArgumentError)


34
35
36
37
38
39
# File 'lib/superglue/resolver.rb', line 34

def initialize(path)
  raise ArgumentError, "path already is a Resolver class" if path.is_a?(ActionView::Resolver)
  @unbound_templates = Concurrent::Map.new
  @path_parser = JsxPathParser.new
  @path = File.expand_path(path)
end

Instance Method Details

#clear_cacheObject



41
42
43
44
# File 'lib/superglue/resolver.rb', line 41

def clear_cache
  @unbound_templates.clear
  @path_parser = JsxPathParser.new
end

#filter_and_sort_by_details(templates, requested_details) ⇒ Object



50
51
52
53
54
55
56
# File 'lib/superglue/resolver.rb', line 50

def filter_and_sort_by_details(templates, requested_details)
  if requested_details.formats.empty?
    templates
  else
    []
  end
end

#source_for_template(template) ⇒ Object



46
47
48
# File 'lib/superglue/resolver.rb', line 46

def source_for_template(template)
  "''"
end