Ruby では、配列で戻すものと、ブロックで繰り返すものがある

p ary = "foobar".scan(/../)
# ["fo", "ob", "ar"]

"foobarbaz".scan(/(ba)(.)/) { |matched| p matched }
# ["ba", "r"], ["ba", "z"]