Method: Assert::View::Base#to_sentence
- Defined in:
- lib/assert/view/base.rb
#to_sentence(things) ⇒ Object
generate a comma-seperated sentence fragment given a list of things
224 225 226 227 228 229 230 |
# File 'lib/assert/view/base.rb', line 224 def to_sentence(things) if things.size <= 2 things.join(things.size == 2 ? ' and ' : '') else [things[0..-2].join(", "), things.last].join(", and ") end end |