Many methods in Ruby array return an enumerator when invoked without parameters or blocks (index, keep_if, each, drop_while and many more).
- When is it appropriate to use methods in this form, as opposed to calling them with a block?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From the docs to
Enumerator:I’m sorry for copy-paste, but I couldn’t explain better.