Skip to content

Instantly share code, notes, and snippets.

@nsave
Created November 21, 2018 10:51
Show Gist options
  • Select an option

  • Save nsave/3623001cb3244f4faa0f7420ded7cdf0 to your computer and use it in GitHub Desktop.

Select an option

Save nsave/3623001cb3244f4faa0f7420ded7cdf0 to your computer and use it in GitHub Desktop.
Stop including Enumerable, return Enumerator instead (https://blog.arkency.com/2014/01/ruby-to-enum-for-enumerator/)
def your_method_name_which_is_usually_each(*args)
return enum_for(:your_method_name_which_is_usually_each, *args) unless block_given?
# go crazy
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment