Module: MoreMath::Sequence::Refinement

Defined in:
lib/more_math/sequence/refinement.rb

Overview

Note:

This refinement must be activated with using MoreMath::Sequence::Refinement before it can be used

Note:

The resulting sequence is frozen and cannot be modified

Refinement module that adds sequence conversion capabilities to Object.

This refinement extends the Object class with a to_seq method that converts any enumerable object into a MoreMath::Sequence.

Examples:

Converting an array to a sequence

using MoreMath::Sequence::Refinement
[1, 2, 3, 4, 5].to_seq
# => #<MoreMath::Sequence:0x00007f8b8c0b8a00>

Converting other enumerables

using MoreMath::Sequence::Refinement
(1..5).to_seq
# => #<MoreMath::Sequence:0x00007f8b8c0b8a00>