Module: RegexpExamples::RandomResultBySample
- Includes:
- ForceLazyEnumerators
- Included in:
- BackReferenceGroup, CharGroup, DotGroup, PlaceHolderGroup, SingleCharGroup
- Defined in:
- lib/regexp-examples/groups.rb
Overview
A helper method for mixing in to Group classes… Uses Array#sample to randomly choose one result from all possible examples
Instance Method Summary collapse
Methods included from ForceLazyEnumerators
Instance Method Details
#random_result ⇒ Object
56 57 58 |
# File 'lib/regexp-examples/groups.rb', line 56 def random_result force_if_lazy(result).sample(1) end |