Exception: Orchestra::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/orchestra/errors.rb

Instance Method Summary collapse

Instance Method Details

#list_out(list) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/orchestra/errors.rb', line 3

def list_out list
  list = list.map &:inspect
  return list.fetch 0 if list.size == 1
  list.fetch 0
  second_to_last, last = list.slice! -2..-1
  str = list.join ', '
  str << ', ' unless str.empty?
  str << "#{second_to_last} and #{last}"
  str
end