File: array_helpers.rb

package info (click to toggle)
ruby-shoulda-matchers 7.0.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,652 kB
  • sloc: ruby: 34,046; sh: 280; makefile: 9
file content (14 lines) | stat: -rw-r--r-- 262 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module AcceptanceTests
  module ArrayHelpers
    def to_sentence(array)
      case array.size
      when 1
        array[0]
      when 2
        array.join(' and ')
      else
        to_sentence(array[1..-2].join(', '), [array[-1]])
      end
    end
  end
end