diff options
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 |