Class: Lutaml::UmlRepository::StaticSite::TemplateFileSystem
- Inherits:
-
Object
- Object
- Lutaml::UmlRepository::StaticSite::TemplateFileSystem
- Defined in:
- lib/lutaml/uml_repository/static_site/generator.rb
Overview
Resolves Liquid include % paths to template files on disk. Unlike LocalFileSystem (which adds a “_” prefix), this resolves paths directly: “components/header” → “<root>/components/header.liquid”
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
-
#initialize(root) ⇒ TemplateFileSystem
constructor
A new instance of TemplateFileSystem.
- #read_template_file(template_path) ⇒ Object
Constructor Details
#initialize(root) ⇒ TemplateFileSystem
Returns a new instance of TemplateFileSystem.
20 21 22 |
# File 'lib/lutaml/uml_repository/static_site/generator.rb', line 20 def initialize(root) @root = root end |
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
18 19 20 |
# File 'lib/lutaml/uml_repository/static_site/generator.rb', line 18 def root @root end |
Instance Method Details
#read_template_file(template_path) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/lutaml/uml_repository/static_site/generator.rb', line 24 def read_template_file(template_path) full = File.("#{template_path}.liquid", @root) unless full.start_with?(@root) raise Liquid::FileSystemError, "Illegal template path: #{template_path}" end File.read(full) end |