title: What's this &block in Ruby? And how does it get passed in a method here?
body: <p>Saw this piece of code in a Ruby on Rails book. This first one is from a view and the second one is a helper module. I don't understand how that <code>&amp;block</code> and the <code>attributes={}</code> thing work. Can anyone guide me to a tutorial of some kind explaining this?</p>
  
  <pre><code>&lt;% hidden_div_if(@cart.items.empty?, :id =&gt; "cart") do %&gt;
   &lt;%= render(:partial =&gt; "cart", :object =&gt; @cart) %&gt;
  &lt;% end %&gt;
  
  module StoreHelper
   def hidden_div_if(condition, attributes = {}, &amp;block)
    if condition
     attributes["style"] = "display: none"
    end
     content_tag("div", attributes, &amp;block)
    end
  end
  </code></pre>