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