Class: Twig::Loader::Filesystem
- Defined in:
- lib/twig/loader/filesystem.rb
Instance Method Summary collapse
- #fresh?(name, time) ⇒ Boolean
- #get_cache_key(name) ⇒ Object
- #get_source_context(name) ⇒ Object
-
#initialize(root_path, paths = []) ⇒ Filesystem
constructor
A new instance of Filesystem.
Methods inherited from Base
Constructor Details
#initialize(root_path, paths = []) ⇒ Filesystem
Returns a new instance of Filesystem.
6 7 8 9 10 11 |
# File 'lib/twig/loader/filesystem.rb', line 6 def initialize(root_path, paths = []) super() @root_path = root_path.to_s @paths = paths.map(&:to_s) end |
Instance Method Details
#fresh?(name, time) ⇒ Boolean
27 28 29 30 31 32 33 |
# File 'lib/twig/loader/filesystem.rb', line 27 def fresh?(name, time) if (file = find_template(name)) return File.mtime(file).to_i < time end false end |
#get_cache_key(name) ⇒ Object
21 22 23 24 25 |
# File 'lib/twig/loader/filesystem.rb', line 21 def get_cache_key(name) return unless (path = find_template(name)) path.delete_prefix(@root_path) end |