InQusitive InQusitive - 4 months ago 33
Ruby Question

What does |_| mean in ruby?

This is a snippet taken from

gem prawn
. What does that
mean in the second line?

def canvas(&block)
init_bounding_box(block, :hold_position => true) do |_|
# Canvas bbox acts like margin_box in that its parent bounds are unset.
@bounding_box =
self, nil, [0, page.dimensions[3]],
:width => page.dimensions[2],
:height => page.dimensions[3]

I am trying to learn ruby by going through different gems.


It's basically just throwing away the value. A normal do block would have something like |my_var|