Skip to Content Skip to Search

A resolver that loads files from the filesystem.

Methods
#
C
E
F
N
T

Attributes

[R] path

Class Public methods

new(path)

# File actionview/lib/action_view/template/resolver.rb, line 99
def initialize(path)
  raise ArgumentError, "path already is a Resolver class" if path.is_a?(Resolver)
  @unbound_templates = Concurrent::Map.new
  @path_parser = PathParser.new
  @path = File.expand_path(path)
  super()
end

Instance Public methods

==(resolver)

Alias for: eql?

clear_cache()

# File actionview/lib/action_view/template/resolver.rb, line 107
def clear_cache
  @unbound_templates.clear
  @path_parser = PathParser.new
  super
end

eager_load_templates(view = nil)

# File actionview/lib/action_view/template/resolver.rb, line 113
def eager_load_templates(view = nil)
  template_glob("**/*").each do |file|
    unbound = build_unbound_template(file)
    (@unbound_templates[unbound.virtual_path] ||= []) << unbound
    unbound.bind_locals([]).send(:compile!, view) if view
  end
end

eql?(resolver)

Also aliased as: ==
# File actionview/lib/action_view/template/resolver.rb, line 138
def eql?(resolver)
  self.class.equal?(resolver.class) && to_path == resolver.to_path
end

find(name, prefix = nil, partial = false, details = {}, key = nil, locals = [])

# File actionview/lib/action_view/template/resolver.rb, line 165
def find(name, prefix = nil, partial = false, details = {}, key = nil, locals = [])
  requested_details = key || TemplateDetails::Requested.new(**details)
  unbound_templates = unbound_templates_for(name, prefix, partial, !!key)

  unbound_template = find_best_by_details(unbound_templates, requested_details)
  return unless unbound_template
  unbound_template.bind_locals(locals)
end

find_all(name, prefix = nil, partial = false, details = {}, key = nil, locals = [])

# File actionview/lib/action_view/template/resolver.rb, line 156
def find_all(name, prefix = nil, partial = false, details = {}, key = nil, locals = [])
  requested_details = key || TemplateDetails::Requested.new(**details)
  unbound_templates = unbound_templates_for(name, prefix, partial, !!key)

  filter_and_sort_by_details(unbound_templates, requested_details).map do |unbound_template|
    unbound_template.bind_locals(locals)
  end
end

freeze()

# File actionview/lib/action_view/template/resolver.rb, line 121
def freeze
  @path.freeze
  @path_parser.freeze
  @unbound_templates = @unbound_templates.each_pair.to_h unless @unbound_templates.is_a?(::Hash)
  @unbound_templates.each_value do |unbound_templates|
    unbound_templates.each(&:freeze)
    unbound_templates.freeze
  end
  @unbound_templates.freeze
  super
end

to_path()

Alias for: to_s

to_s()

Also aliased as: to_path
# File actionview/lib/action_view/template/resolver.rb, line 133
def to_s
  @path.to_s
end