Sha256: d78657a2ebf528682ad41a4ee6f16c9ca3edaf3be45fc9b4d61ca966ad39f472
Contents?: true
Size: 1009 Bytes
Versions: 1
Compression:
Stored size: 1009 Bytes
Contents
require "erubis" module Musterb autoload :VERSION, "musterb/version" autoload :ExtractValues, "musterb/extract_values" autoload :Musterbifier, "musterb/musterbifier" autoload :BindingExtractor, "musterb/binding_extractor" autoload :HashExtractor, "musterb/hash_extractor" autoload :ObjectExtractor, "musterb/object_extractor" autoload :NullExtractor, "musterb/null_extractor" autoload :Evaluator, "musterb/evaluator" autoload :Chain, "musterb/chain" autoload :TemplateHandler, "musterb/template_handler" def self.to_erb(template, options = {}) klass = options[:musterbifier_klass] || Musterbifier musterbifier = klass.new(template) initial_context = options[:initial_context] || 'Musterb::BindingExtractor.new binding' "<% Musterb::Evaluator.new(#{initial_context}).tap do |musterb| %>#{musterbifier.to_erb}<% end %>" end def self.render(template, values) Erubis::Eruby.new(to_erb template).result(values) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
musterb-0.1.0 | lib/musterb.rb |