Method: Immutable::Vector#take_while
- Defined in:
- lib/immutable/vector.rb
#take_while ⇒ Vector, Enumerator
Gather elements up to, but not including, the first element for which the block returns nil or false, and return them in a new Vector. If no block is given, an Enumerator is returned instead.
754 755 756 757 |
# File 'lib/immutable/vector.rb', line 754 def take_while return enum_for(:take_while) if not block_given? self.class.new(super) end |