class Array
Ruby class
Public Instance Methods
separate(sep = '')
click to toggle source
Inserts an separator between each element
@param sep [String] string to be used as separator
@return [Array] the new array
# File lib/jaspion/kilza.rb, line 36 def separate(sep = '') a = self l = a.length - 2 (0..l).each { |i| a.insert(((2 * i) + 1), sep) } a end
separate!(sep = '')
click to toggle source
Inserts an separator between each element
@param sep [String] string to be used as separator
# File lib/jaspion/kilza.rb, line 46 def separate!(sep = '') l = length - 2 (0..l).each { |i| insert(((2 * i) + 1), sep) } end