Module: Enumerable
- Defined in:
- runtime/ext/enumerable.rb,
runtime/ext/enumerable.rbs
Overview
Enumerable — the collection predicates and projections.
Instance Method Summary collapse
-
#index_by ⇒ Hash
the collection as a Hash keyed by the block's value; last write wins on duplicates.
-
#many? ⇒ Boolean
more than one element.
-
#sole ⇒ untyped
the one element, asserting the count instead of only reading the first:
firstwould keep the read and drop the assertion.
Instance Method Details
#index_by ⇒ Hash
the collection as a Hash keyed by the block's value; last write wins on duplicates.
7 |
# File 'runtime/ext/enumerable.rb', line 7
def index_by: () { (untyped) -> untyped } -> Hash[untyped, untyped]
|
#many? ⇒ Boolean
more than one element.
length answers it because everything that reaches here is already
materialized.
19 |
# File 'runtime/ext/enumerable.rb', line 19
def many?: () -> bool
|
#sole ⇒ untyped
the one element, asserting the count instead of only reading the first:
first would keep the read and drop the assertion.
28 |
# File 'runtime/ext/enumerable.rb', line 28
def sole: () -> untyped
|