Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/usaidwat/ext/array.rb
Instance Method Summary collapse
Instance Method Details
#or_join ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/usaidwat/ext/array.rb', line 6 def or_join case count when 0 '' when 1 first when 2 join(' or ') else last_entry = 'or ' + last items = self[0...-1] << last_entry items.join(', ') end end |
#subreddits ⇒ Object
2 3 4 |
# File 'lib/usaidwat/ext/array.rb', line 2 def subreddits join(' ').split(/[ ,\+]/).map { |sr| sr.downcase } end |