InQusitive InQusitive - 15 days ago 5
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 = BoundingBox.new(
self, nil, [0, page.dimensions[3]],
:width => page.dimensions[2],
:height => page.dimensions[3]
)
end
end


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

Answer

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