Sha256: 84edddaa44cf7405696b05de71234ab88b8fac46d58dc419899ddc69ee588b3d
Contents?: true
Size: 372 Bytes
Versions: 2
Compression:
Stored size: 372 Bytes
Contents
class Pratt class Formats module Array ## # Turns an array into a sentence # # @param [String] conjunction # @return [String] def to_sentence conjunction = 'and' self[0..-2].join(", ") << (self.size > 2 ? ',' : '') << " #{conjunction} #{self.last}" end end end end Array.send :include, Pratt::Formats::Array
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
Pratt-1.6.5 | lib/pratt/core_ext/array.rb |
Pratt-1.6.4 | lib/pratt/core_ext/array.rb |