Class: ArrayOperation

Inherits:
Object
  • Object
show all
Defined in:
lib/pokotarou/array_operation.rb

Class Method Summary collapse

Class Method Details

.get_rotated_val(array, size, cnt) ⇒ Object

return rotated val in passed array

Raises:



5
6
7
8
9
10
11
# File 'lib/pokotarou/array_operation.rb', line 5

def get_rotated_val array, size, cnt
  raise NothingDataError.new("Nothing seed data") if array.nil?
  raise NothingDataError.new("Seed data is empty") if size.zero?
  x = (size + cnt) / size

  array[ size + cnt - size * x ]
end