Arturo Herrero

Powercore

During the last few weeks I have been working on PowerCore, which extends the Ruby Core with useful extensions. This project was featured in issue #293 of Ruby Weekly newsletter.

There are Ruby gems that do something similar, such as ActiveSuppor Core Extensions or Powerpack.

In this case, this is just a collection of extensions for reference, not a Ruby gem. Who wants a new dependency in the code base? Just borrow the code that you consider useful, but be careful;

…most of the time I have created new methods:

"abc".first  # => "a"

…but sometimes I have overridden the default Ruby implementation:

[1, 2, 3, 4].take(-2)  # => [3, 4]

…or even worse, I have removed Ruby methods to do some tricks:

[1,2,3] |
  ->(array)  { array.first } |
  ->(int)    { int.to_s } |
  ->(string) { string + "2" }
# => "12"

Come and see!