Module: Poefy::CoreExtensions::Array::ModuloIndex
- Included in:
- Array
- Defined in:
- lib/poefy/core_extensions/array.rb,
lib/poefy/core_extensions/array.rb
Overview
– Define module methods. ++
Instance Method Summary collapse
-
#modulo_index(divider, remainder = 0, start_index = 0) ⇒ Object
Return elements located at specific index periods.
Instance Method Details
#modulo_index(divider, remainder = 0, start_index = 0) ⇒ Object
Return elements located at specific index periods.
106 107 108 109 110 |
# File 'lib/poefy/core_extensions/array.rb', line 106 def modulo_index(divider, remainder = 0, start_index = 0) self.values_at(* self.each_index.select do |i| (i + start_index) % divider == remainder end) end |