Sha256: 4652ef50e03f8884cc9ba0c971168f54ac5421193426aeed70ee9404f41e23b0

Contents?: true

Size: 695 Bytes

Versions: 6

Compression:

Stored size: 695 Bytes

Contents

# HoboSupport - Methodphitamine

    >> require 'hobosupport'

## `Kernel#it` and `Kernel#its`

A nice hack from Jay Phillips, christened "Methodphitamine". The low-down is in the [original blog post][1].

[1]: http://jicksta.com/articles/2007/08/04/the-methodphitamine

    >> (1..10).select &it % 2 == 0
    => [2, 4, 6, 8, 10]
    >> %w(a few short words).map &its.length
    => [1, 3, 5, 5]

Note that `it` and `its` are identical. They just read better in different contexts. Note that methodphitamine is also released directly by Jay (simply `gem install methodphitamine`) but it's small enough that it seemed easier to add it to HoboSupport and avoid an extra dependency. Thanks to Jay.

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hobosupport-0.8 test/hobosupport/methodphitamine.rdoctest
hobosupport-0.8.5 test/hobosupport/methodphitamine.rdoctest
hobosupport-0.8.1 test/hobosupport/methodphitamine.rdoctest
hobosupport-0.8.2 test/hobosupport/methodphitamine.rdoctest
hobosupport-0.8.3 test/hobosupport/methodphitamine.rdoctest
hobosupport-0.8.4 test/hobosupport/methodphitamine.rdoctest