title: I'm getting an error when I try to register a module with sinatra
body: <p>I'm getting this error:</p>
  
  <pre><code>/.rvm/gems/ruby-2.1.3/gems/sinatra-1.4.5/lib/sinatra/base.rb:1388:in `register': undefined method `+' for nil:NilClass (NoMethodError)
  </code></pre>
  
  <p>when I try to register an extension using either </p>
  
  <pre><code>context.send method, component
  </code></pre>
  
  <p>or </p>
  
  <pre><code>context.instance_eval "#{method} #{component}",__FILE__,__LINE__
  </code></pre>
  
  <ol>
  <li>context = <code>App &lt; Sinatra::Base</code></li>
  <li>method = <code>:register</code></li>
  <li>component = <code>Sinatra::ModuleName</code></li>
  </ol>
  
  <p>Thing is doing the same thing with <code>helpers</code> works perfectly fine, it's only when I try to do it this way with an extension.</p>
  
  <p>edit:</p>
  
  <p>Here's the code block it's erroring at:</p>
  
  <pre><code>  def register(*extensions, &amp;block)
      extensions &lt;&lt; Module.new(&amp;block) if block_given?
      @extensions += extensions
      extensions.each do |extension|
        extend extension
        extension.registered(self) if extension.respond_to?(:registered)
      end
    end
  </code></pre>
  
  <p>specifically  <code>@extensions += extensions</code></p>