Sha256: ce97abbc6bc82a1108c2f17c0d8ab0f05877ab334ca812b3b7ca53bf69517a73
Contents?: true
Size: 336 Bytes
Versions: 3
Compression:
Stored size: 336 Bytes
Contents
# encoding: utf-8 class Array def to_list(separator: ', ', last_separator: separator, around: '"') items = self.map { |l| format("#{around}%s#{around}", l) } return items.join(last_separator) if items.size <= 2 result = items.slice(0..-2).join(separator) << last_separator result << items.last result end end
Version data entries
3 entries across 3 versions & 1 rubygems