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.
16 17 18 |
# File 'lib/lutaml/uml_repository/static_site/generator.rb', line 16 def initialize(root) @root = root end |
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
14 15 16 |
# File 'lib/lutaml/uml_repository/static_site/generator.rb', line 14 def root @root end |
Instance Method Details
#read_template_file(template_path) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/lutaml/uml_repository/static_site/generator.rb', line 20 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 |