Method: JSONAPI::Utility.to_string_collection
- Defined in:
- lib/easy/jsonapi/utility.rb
.to_string_collection(collection, delimiter: ', ', pre_string: '', post_string: '') ⇒ Object
Helper method for #to_s that stringifys a collection
69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/easy/jsonapi/utility.rb', line 69 def to_string_collection(collection, delimiter: ', ', pre_string: '', post_string: '') to_return = pre_string first = true collection.each do |item| if first to_return += item.to_s first = false else to_return += "#{delimiter}#{item}" end end to_return += post_string end |