Sha256: f10c56c862ed5d473003badadef7852ecfc43d049eb4f8bca7aadb2cbb723db5
Contents?: true
Size: 412 Bytes
Versions: 15
Compression:
Stored size: 412 Bytes
Contents
# frozen_string_literal: true require 'erb' class Ree::RenderUtils def self.render(template, locals) new(locals).render(template) end def initialize(locals = {}) @render_binding = binding @locals = locals end def render(template) @locals.each { |variable, value| @render_binding.local_variable_set(variable, value) } ERB.new(template).result(@render_binding) end end
Version data entries
15 entries across 15 versions & 1 rubygems