Sha256: 57d1e3ceba538aaceef1beb6758f00dda13f7887b4211af5f3e433284b6c96be
Contents?: true
Size: 517 Bytes
Versions: 2
Compression:
Stored size: 517 Bytes
Contents
require 'erb' module Space class View include Helpers def template_name self.class.name.downcase.split('::').last end def render(name, assigns) assigns.each { |name, value| assign(name, value) } template(name).result(binding) end def assign(key, value) instance_variable_set(:"@#{key}", value) (class << self; self; end).send(:attr_reader, key) end def template(name) ERB.new(File.read(TEMPLATES[name.to_sym]), nil, '%<>-') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
space-0.0.3 | lib/space/view.rb |
space-0.0.2 | lib/space/view.rb |