Sha256: d58c6f588ab2b03f92a47b7403581548fcd7e575b0cfdfc1abd327eef97f60c4
Contents?: true
Size: 533 Bytes
Versions: 35
Compression:
Stored size: 533 Bytes
Contents
# Responsible for decorating a collection which responds to `to_a` which will # stringify all of the elements. # # Example # # ArrayStringifier.new({a: 1, b: 2}).to_a # => [["a", "1"], ["b", "2"]] # class ArrayStringifier < SimpleDelegator alias_method :collection, :__getobj__ def to_a stringify_items(collection.to_a) end private def stringify_items(collection) collection.map do |item| if item.respond_to?(:map) stringify_items(item) else item.to_s end end end end
Version data entries
35 entries across 35 versions & 1 rubygems