method
to_sentence
1.3.1 -
Show latest stable
-
0 notes -
Class: Spec::Matchers::Pretty
- 1.1.4
- 1.1.12
- 1.2.0
- 1.2.8 (0)
- 1.3.0 (0)
- 1.3.1 (0)
- What's this?
to_sentence(words=[])
public
Hide source
# File lib/spec/matchers/pretty.rb, line 8 def to_sentence(words=[]) words = words.map{|w| w.inspect} case words.length when 0 "" when 1 " #{words[0]}" when 2 " #{words[0]} and #{words[1]}" else " #{words[0...-1].join(', ')}, and #{words[-1]}" end end