Class: Glim::LocalFileSystem
- Inherits:
-
Object
- Object
- Glim::LocalFileSystem
- Defined in:
- lib/liquid_ext.rb
Instance Method Summary collapse
-
#initialize(*paths) ⇒ LocalFileSystem
constructor
A new instance of LocalFileSystem.
- #read_template_file(name) ⇒ Object
Constructor Details
#initialize(*paths) ⇒ LocalFileSystem
Returns a new instance of LocalFileSystem.
229 230 231 |
# File 'lib/liquid_ext.rb', line 229 def initialize(*paths) @paths = paths.reject { |path| path.nil? } end |
Instance Method Details
#read_template_file(name) ⇒ Object
233 234 235 236 237 238 239 240 241 242 |
# File 'lib/liquid_ext.rb', line 233 def read_template_file(name) @cache ||= {} unless @cache[name] paths = @paths.map { |path| File.join(path, name) } if file = paths.find { |path| File.exist?(path) } @cache[name] = Glim.preprocess_template(File.read(file)) end end @cache[name] end |