Sha256: e6800d8a1364904cf83f8c254f7b260afd868e9e717b54ce2e12eee9da298b46

Contents?: true

Size: 737 Bytes

Versions: 2

Compression:

Stored size: 737 Bytes

Contents

require "musterb/version"
require "musterb/extract_values"
require "musterb/musterbifier"
require "musterb/binding_extractor"
require "musterb/hash_extractor"
require "musterb/object_extractor"
require "musterb/null_extractor"
require "musterb/evaluator"
require "musterb/chain"

require "erubis"

module Musterb
  def self.to_erb(template, options = {})
    musterbifier = Musterbifier.new(template, options[:render_partial_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

2 entries across 2 versions & 1 rubygems

Version Path
musterb-0.0.7 lib/musterb.rb
musterb-0.0.6 lib/musterb.rb