Class: ActionView::FileSystemResolver

Inherits:
Resolver
  • Object
show all
Defined in:
lib/action_view/template/resolver.rb

Overview

A resolver that loads files from the filesystem.

Direct Known Subclasses

FixtureResolver

Constant Summary

Constants inherited from Resolver

Resolver::Path

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Resolver

#find_all

Constructor Details

#initialize(path) ⇒ FileSystemResolver

Returns a new instance of FileSystemResolver.

Raises:

  • (ArgumentError)


90
91
92
93
94
95
96
# File 'lib/action_view/template/resolver.rb', line 90

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 Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



88
89
90
# File 'lib/action_view/template/resolver.rb', line 88

def path
  @path
end

Instance Method Details

#all_template_pathsObject

:nodoc:



114
115
116
117
118
119
120
121
# File 'lib/action_view/template/resolver.rb', line 114

def all_template_paths # :nodoc:
  paths = template_glob("**/*")
  paths.map do |filename|
    filename.from(@path.size + 1).remove(/\.[^\/]*\z/)
  end.uniq.map do |filename|
    TemplatePath.parse(filename)
  end
end

#clear_cacheObject



98
99
100
101
102
# File 'lib/action_view/template/resolver.rb', line 98

def clear_cache
  @unbound_templates.clear
  @path_parser = PathParser.new
  super
end

#eql?(resolver) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


109
110
111
# File 'lib/action_view/template/resolver.rb', line 109

def eql?(resolver)
  self.class.equal?(resolver.class) && to_path == resolver.to_path
end

#to_sObject Also known as: to_path



104
105
106
# File 'lib/action_view/template/resolver.rb', line 104

def to_s
  @path.to_s
end