Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/utility_functions.rb
Instance Method Summary collapse
Instance Method Details
#to_sentence ⇒ Object
2 3 4 5 6 7 8 |
# File 'lib/utility_functions.rb', line 2 def to_sentence case self.size when 1 then self.first when 2 then self.join(' and ') else self[0..-2].join(', ') + " and #{self.last}" end end |