There are some good answers here already, so I'm not going to give another one. However, it might help to understand what's going wrong here. Every block in Ruby returns the evaluation of it's last statement.
The times method returns the number of times the blocks was run.
The each method returns the array that the block was run on.
Seeing a pattern here? Most of these iterator methods return what was passed to it.
Blocks are passed to the calling function almost like an argument. Essentially this is what's happening in your code.
block = Proc.new { image_tag("24gray/spacer.png", :class => "spacer")}
def space(spacer_count)
spacer_count.times(&block)
end
Knowing now that iterators return what was passed to it, you can see why space(6) returns 6