Module: RegexpExamples::ForceLazyEnumerators
- Included in:
- GroupWithIgnoreCase, RandomResultBySample
- Defined in:
- lib/regexp-examples/groups.rb
Overview
A helper method for mixing in to Group classes… Needed because sometimes (for performace) group results are lazy enumerators; Meanwhile other times (again, for performance!) group results are just arrays
Instance Method Summary collapse
Instance Method Details
#force_if_lazy(arr_or_enum) ⇒ Object
27 28 29 |
# File 'lib/regexp-examples/groups.rb', line 27 def force_if_lazy(arr_or_enum) arr_or_enum.respond_to?(:force) ? arr_or_enum.force : arr_or_enum end |