# File lib/spec/matchers/pretty.rb, line 22 22: def _pretty_print(array) 23: result = "" 24: array.each_with_index do |item, index| 25: if index < (array.length - 2) 26: result << "#{item.inspect}, " 27: elsif index < (array.length - 1) 28: result << "#{item.inspect} and " 29: else 30: result << "#{item.inspect}" 31: end 32: end 33: result 34: end
# File lib/spec/matchers/pretty.rb, line 4 4: def split_words(sym) 5: sym.to_s.gsub(/_/,' ') 6: end
# File lib/spec/matchers/pretty.rb, line 8 8: def to_sentence(words) 9: words = words.map{|w| w.inspect} 10: case words.length 11: when 0 12: "" 13: when 1 14: " #{words[0]}" 15: when 2 16: " #{words[0]} and #{words[1]}" 17: else 18: " #{words[0...-1].join(', ')}, and #{words[-1]}" 19: end 20: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.