Module: ArrayHelper

Included in:
Array
Defined in:
lib/rubyhelper/arrayhelper.rb

Instance Method Summary collapse

Instance Method Details

#to_clean_s(sep = ' ') ⇒ Object

A simple function like to_s(), but return a clean String for exemple :

[1,2,3].to_clean_s(" ; ")

> “1 ; 2 ; 3”

Parameters:

sep:
A String to separe each element (or an Array, see to_clean_s_with_array)


12
13
14
15
# File 'lib/rubyhelper/arrayhelper.rb', line 12

def to_clean_s(sep=' ')
  return to_clean_s_with_array(sep) if sep.is_a?Array
  to_clean_s_with_string(sep.to_s)
end