diff options
author | mms <git@sapka.me> | 2024-12-27 00:16:14 +0100 |
---|---|---|
committer | mms <git@sapka.me> | 2024-12-27 00:16:14 +0100 |
commit | d3316d0b042ffa550ff56ed4e691c80003dd1414 (patch) | |
tree | dedf93e497bb3c95b5f952a79b13dc89d3670fcf /new/lib/crys/renderer.rb | |
parent | 9ff71af752746fd4d61e7b5a1f025b1943f60dea (diff) |
feat(new): server mode
Diffstat (limited to 'new/lib/crys/renderer.rb')
-rw-r--r-- | new/lib/crys/renderer.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/new/lib/crys/renderer.rb b/new/lib/crys/renderer.rb new file mode 100644 index 0000000..c490330 --- /dev/null +++ b/new/lib/crys/renderer.rb @@ -0,0 +1,32 @@ +require 'erb' +require 'pry' + +module Crys + module Splash + class Theme + PARENT_DIR = File.expand_path(".", Dir.pwd) + + def render + template = ERB.new(File.read(PARENT_DIR + "/theme/" + self.class::PAGE)) + template.result(local_binding) + end + + def body + self.class::BODY.result(local_binding) + end + + private + + attr_accessor :template, :data + + def local_binding + local_binding = binding.clone + self.class::DATA.each do |k, v| + local_binding.local_variable_set(k,v) + end + local_binding + + end + end + end +end |