Method: Immutable::List#drop_while
- Defined in:
- lib/immutable/list.rb
#drop_while {|item| ... } ⇒ List, Enumerator
Return a List which contains all elements starting from the first element for which the block returns nil or false.
308 309 310 311 312 313 314 315 |
# File 'lib/immutable/list.rb', line 308 def drop_while(&block) return enum_for(:drop_while) unless block_given? LazyList.new do list = self list = list.tail while !list.empty? && yield(list.head) list end end |