title: ruby on rails: (eval):1: syntax error, unexpected $undefined
body: <p>I'm getting the following syntax error:</p>
  
  <pre><code>(eval):1: syntax error, unexpected $undefined
  $#&lt;MenuBuilder:0x007fccee84e7f8&gt; = #&lt;MENUBUILDER:0X007FCCEE84E7F8&gt;
   ^
  </code></pre>
  
  <p>This is code execution:</p>
  
  <h1>_main_menu.html.haml</h1>
  
  <pre><code>#main-menu 
    = menu do |m| 
      = m.submenu "Products" do 
        = m.item "Products", Product 
  </code></pre>
  
  <h1>builders_helper.rb</h1>
  
  <pre><code>module BuildersHelper 
    def menu(options = {}, &amp;block) 
      MenuBuilder.new(self).root(options, &amp;block) 
    end 
  end 
  </code></pre>
  
  <h1>menu_builder.rb</h1>
  
  <pre><code>class MenuBuilder 
    attr_accessor :template 
    def initialize(template) 
      @template = template 
    end 
    def root(options, &amp;block) 
      options[:class] = "jd_menu jd_menu_slate ui-corner-all" 
      content_tag :ul, capture(self, &amp;block), options 
    end 
    def item(title, url, options = {}) 
      content_tag :li, options do 
        url = ajax_route(url) unless String === url 
        url = dash_path + url if url.starts_with?("#") 
        link_to title, url 
      end 
    end 
    def submenu(title, options = {}, &amp;block) 
      content_tag :li do 
        content_tag(:h6, title.t) + 
        content_tag(:ul, capture(self, &amp;block), :class =&gt; "ui-corner- 
  all") 
      end 
    end 
  end 
  </code></pre>
  
  <p>It fails on the capture() call in the root method:</p>
  
  <pre><code>content_tag :ul, capture(self, &amp;block), options
  </code></pre>
  
  <p>self refers to the instance of MenuBuilder and I am positive that a block is passed as the other parameter. If I throw a puts statement in an if block_given? it will execute, but it wont get passed that content_tag line above.</p>