I trying to define a helper method that takes the Enumerable as arguments and should return processed values. Look at example of my problem.
>> def bar
>> yield(->(x) { x.nil? })
>> end
>> bar { [nil, nil, 1].reject }
=> #<Enumerator: [nil, nil, 1]:reject>
I can't understand. An example below works as expected:
>> [nil, nil, 1].reject { |x| x.nil? }
=> [1]
What is missing here? Why i get a Enumerator instance instead of result?