Module: ArraySentence

Included in:
NormalizedArrayMethods::InstanceMethods
Defined in:
lib/doodle/normalized_array.rb

Instance Method Summary collapse

Instance Method Details

#join_with(sep = ', ', last = ' and ') ⇒ Object



4
5
6
7
8
9
10
# File 'lib/doodle/normalized_array.rb', line 4

def join_with(sep = ', ', last = ' and ')
  if self.size > 1
    self[0..-2].join(sep) + last + self[-1].to_s
  else
    self[0].to_s
  end
end