module RSpec::Matchers::EnglishPhrasing
def self.Array(obj)
- Private: -
def self.Array(obj) case obj when Array then obj else [obj] end end
def self.list(obj)
- Note: - The returned string has a leading space except
def self.list(obj) return " #{RSpec::Support::ObjectFormatter.format(obj)}" if !obj || Struct === obj || Hash === obj items = Array(obj).map { |w| RSpec::Support::ObjectFormatter.format(w) } case items.length when 0 "" when 1 " #{items[0]}" when 2 " #{items[0]} and #{items[1]}" else " #{items[0...-1].join(', ')}, and #{items[-1]}" end end
def self.split_words(sym)
split_words(:banana_creme_pie) #=> "banana creme pie"
Converts a symbol into an English expression.
def self.split_words(sym) sym.to_s.tr('_', ' ') end