Class: Spark::Command::Take

Inherits:
Object
  • Object
show all
Defined in:
lib/spark/command/basic.rb

Overview


Take

Instance Method Summary collapse

Instance Method Details

#run(iterator, index) ⇒ Object



281
282
283
284
285
286
287
# File 'lib/spark/command/basic.rb', line 281

def run(iterator, index)
  if index == @last_part && iterator.size > @total
    return iterator.slice!(0, @total)
  end

  iterator
end