title: Ruby: calling 'join' after a block
body: <p>I'm watching a RailsCast (#101) in which the authoruses some methods to make a star rating system for a blog.  In the method <code>star_image</code>s, he calls join on the end of a block.  I think this turns an array into a string, but why would that need to be done? </p>
  
  <p><strong>View</strong></p>
  
  <pre><code>&lt;%= render_stars(product.rating) %&gt;
  </code></pre>
  
  <p><strong>Application_helper.rb</strong></p>
  
  <pre><code> def render_stars
      content_tag :div, star_images, :class =&gt; 'stars'
    end
  </code></pre>
  
  <p>private</p>
  
  <pre><code> def star_images
      (0...5).map do |position|
        star_image(((@rating-position)*2).round)
      end.join
    end
  
    def star_image(value)
      image_tag "/images/#{star_type(value)}_star.gif", :size =&gt; '15x15'
    end
  
    def star_type(value)
      if value &lt;= 0
        'empty'
      elsif value == 1
        'half'
      else
        'full'
      end
    end
  </code></pre>