Read more

Ruby: The & operator

Dominik Schöler
October 30, 2013Software engineer at makandra GmbH

After reading, you will know why and how runners.each(&:run) works. Here some tidbits:

& can be quite confusing because it has a different meaning depending on the context in which it's used.

&object is evaluated in the following way:

  • if object is a block, it converts the block into a simple proc.
  • if object is a Proc, it converts the object into a block while preserving the lambda? status of the object.
  • if object is not a Proc, it first calls #to_proc on the object and then converts it into a block.
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot
Posted by Dominik Schöler to makandra dev (2013-10-30 22:08)