If you just want to add it, you can use the succ
method:
>> [1,2,3,4].map(&:succ) => [2, 3, 4, 5]
If you want to add two, you can use lambda:
>> add_2 = ->(i) { i + 2 } >> [1,2,3,4].map(&add_2) => [3, 4, 5, 6]
For arbitrary values, you can use the lambda that builds lambdas:
>> add_n = ->(n) { ->(i) { i + n } } >> [1,2,3,4].map(&add_n[3]) => [4, 5, 6, 7]
You can also use the lambda generation method:
>> def add_n(n) ->(i) { i + n } end >> [1,2,3,4].map(&add_n(3)) => [4, 5, 6, 7]