Class: ExAequo::Base::Enumerable::ArrayHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/ex_aequo/base/enumerable/array.rb

Instance Method Summary collapse

Instance Method Details

#extractObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/ex_aequo/base/enumerable/array.rb', line 8

def extract
  fst = @slice.first
  lst = @slice.last

  @middle = @ary[@slice]
  @head = @ary[0...fst]

  @tail = tail_slice(lst, exclude_end: @slice.exclude_end?) 
  [@head, @middle, @tail].map(&Array)
end

#map_slice(&blk) ⇒ Object



19
20
21
22
# File 'lib/ex_aequo/base/enumerable/array.rb', line 19

def map_slice(&blk)
  extract
  @head + @middle.map(&blk) + @tail
end