Sha256: 0f0d2e913b5b1476b1960e08b94d6e55a47cef5dc7d8a4695b31bf3be2f5359f
Contents?: true
Size: 410 Bytes
Versions: 16
Compression:
Stored size: 410 Bytes
Contents
Array.class_eval do #convert all elements of array to symbols #throw exception if all elements are not of class String def to_sym new_ary = [] old_ary = to_ary old_ary.each do |item| if item.class == String new_ary << item.to_sym else throw "All array elements must be of class String to use to_sym" end end new_ary end end
Version data entries
16 entries across 16 versions & 1 rubygems