- Curly brackets are blocks in Ruby.
- The
yield
keyword will execute the block which passed to methods. - All Ruby methods accept blocks implicitly.
assert { swear == "shoot" }
actually sends the block to assert
method. Since the evaluation of the block is true
, there is no exception raised. While { swear == "snot head" }
is false, assert
method raises an exception.