Sha256: b54108936c25abf64a2947688ed3b2575d442670f74f8792f23e78de889683ad
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 KB
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 :InstanceVariableExtractor, "musterb/instance_variable_extractor" autoload :NullExtractor, "musterb/null_extractor" autoload :Evaluator, "musterb/evaluator" autoload :Chain, "musterb/chain" autoload :RailsLocalsExtractor, "musterb/rails_locals_extractor" 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::NullExtractor.new)' "<% 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
musterb-1.0.1 | lib/musterb.rb |
musterb-0.2.0 | lib/musterb.rb |