Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/akaza/ruby2ws/prelude.rb

Instance Method Summary collapse

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/akaza/ruby2ws/prelude.rb', line 10

def empty?
  size == 0
end

#firstObject



2
3
4
# File 'lib/akaza/ruby2ws/prelude.rb', line 2

def first
  self[0]
end

#lastObject



6
7
8
# File 'lib/akaza/ruby2ws/prelude.rb', line 6

def last
  self[size-1]
end

#zip(other) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/akaza/ruby2ws/prelude.rb', line 14

def zip(other)
  res = []
  idx = 0
  while idx < size
    res.push(idx < other.size ? [self[idx], other[idx]] : [self[idx], nil])
    idx = idx + 1
  end
  res
end