<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,8 @@
+== 0.1.3
+
+* registered type blocks now take a Hash as the second parameter
+* template filenames now show up in backtraces
+
 == 0.1.2
 
 * controls may now accept a delegate object, which methods will be relayed to</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -53,10 +53,15 @@ module Instrument
     # String.  The block should ensure that all necessary libraries are
     # loaded.
     #
-    #  @param [Array] type_list the template types being registered
-    #  @yield the block generates the template output
-    #  @yieldparam [String] the template input
-    #  @yieldparam [Object] the execution context for the template
+    #  @param [Array] type_list The template types being registered.
+    #  @yield The block generates the template output.
+    #  @yieldparam [String] input
+    #    The template input.
+    #  @yieldparam [Hash] options
+    #    Additional parameters.
+    #    :context - The execution context for the template, which will be set
+    #      to the control object.
+    #    :filename - The filename of the template being rendered.
     def self.register_type(*type_list, &amp;block)
       # Ensure the @@type_map is initialized.
       self.types
@@ -107,9 +112,7 @@ module Instrument
     #
     #  @param [Class] klass the subclass that is extending Control
     def self.inherited(klass)
-      if !defined?(@@control_subclasses) || @@control_subclasses == nil
-        @@control_subclasses = []
-      end
+      @@control_subclasses ||= []
       @@control_subclasses &lt;&lt; klass
       @@control_subclasses.uniq!
       super
@@ -122,9 +125,7 @@ module Instrument
     #  @return [Instrument::Control, NilClass] the desired control or nil
     #  @see Instrument::Control.control_name
     def self.lookup(control_name)
-      if !defined?(@@control_subclasses) || @@control_subclasses == nil
-        @@control_subclasses = []
-      end
+      @@control_subclasses ||= []
       for control_subclass in @@control_subclasses
         if control_subclass.control_name == control_name
           return control_subclass
@@ -298,7 +299,9 @@ module Instrument
       end
 
       begin
-        return self.class.processor(type).call(raw_content, self)
+        return self.class.processor(type).call(
+          raw_content, {:context =&gt; self, :filename =&gt; path}
+        )
       rescue Exception =&gt; e
         e.message &lt;&lt;
           &quot;\nError occurred while rendering &quot; +
@@ -310,23 +313,36 @@ module Instrument
 end
 
 # Register the default types.
-Instrument::Control.register_type(:haml) do |input, context|
+Instrument::Control.register_type(:haml) do |input, options|
   require &quot;haml&quot;
-  Haml::Engine.new(input, {:attr_wrapper =&gt; &quot;\&quot;&quot;}).render(context)
+  context = options[:context]
+  filename = options[:filename]
+  Haml::Engine.new(
+    input, :attr_wrapper =&gt; &quot;\&quot;&quot;, :filename =&gt; filename
+  ).render(context)
 end
-Instrument::Control.register_type(:erb, :rhtml) do |input, context|
+Instrument::Control.register_type(:erb, :rhtml) do |input, options|
   begin; require &quot;erubis&quot;; rescue LoadError; require &quot;erb&quot;; end
+  context = options[:context]
+  filename = options[:filename]
+  binding = context.instance_eval { (lambda {}).binding }
   erb = Erubis::Eruby.new(input) rescue ERB.new(input)
-  erb.result(context.send(:binding))
+  if erb.respond_to?(:filename=)
+    erb.filename = filename
+  end
+  erb.result(binding)
 end
-Instrument::Control.register_type(:mab) do |input, context|
+Instrument::Control.register_type(:mab) do |input, options|
   require &quot;markaby&quot;
+  context = options[:context]
   Markaby::Builder.new({}, context).capture do
     eval(input)
   end
 end
-Instrument::Control.register_type(:rxml) do |input, context|
+Instrument::Control.register_type(:rxml) do |input, options|
   require &quot;builder&quot;
+  context = options[:context]
   xml = Builder::XmlMarkup.new(:indent =&gt; 2)
-  eval(input, context.send(:binding))
+  binding = context.instance_eval { (lambda {}).binding }
+  eval(input, binding)
 end</diff>
      <filename>lib/instrument/control.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c574b0ba731d1f1c200365b456a1966bb0db359b</id>
    </parent>
  </parents>
  <author>
    <name>Bob Aman</name>
    <email>bob@sporkmonger.com</email>
  </author>
  <url>http://github.com/sporkmonger/instrument/commit/d7b51073980d8e2e0e36390bc90cb231c8196edb</url>
  <id>d7b51073980d8e2e0e36390bc90cb231c8196edb</id>
  <committed-date>2008-10-23T11:54:27-07:00</committed-date>
  <authored-date>2008-10-23T11:54:27-07:00</authored-date>
  <message>Fixed backtraces.</message>
  <tree>0bec85785c68df016b93b92c08fde3fea9564e80</tree>
  <committer>
    <name>Bob Aman</name>
    <email>bob@sporkmonger.com</email>
  </committer>
</commit>
