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

Version Path
erp_base_erp_svcs-4.2.0 lib/erp_base_erp_svcs/extensions/core/array.rb
erp_base_erp_svcs-4.0.0 lib/erp_base_erp_svcs/extensions/core/array.rb
erp_base_erp_svcs-3.1.5 lib/erp_base_erp_svcs/extensions/core/array.rb
erp_base_erp_svcs-3.1.4 lib/erp_base_erp_svcs/extensions/core/array.rb
erp_base_erp_svcs-3.1.3 lib/erp_base_erp_svcs/extensions/core/array.rb
erp_base_erp_svcs-3.1.2 lib/erp_base_erp_svcs/extensions/core/array.rb
erp_base_erp_svcs-3.1.1 lib/erp_base_erp_svcs/extensions/core/array.rb
erp_base_erp_svcs-3.0.7 lib/erp_base_erp_svcs/extensions/core/array.rb
erp_base_erp_svcs-3.1.0 lib/erp_base_erp_svcs/extensions/core/array.rb
erp_base_erp_svcs-3.0.6 lib/erp_base_erp_svcs/extensions/core/array.rb
erp_base_erp_svcs-3.0.5 lib/erp_base_erp_svcs/extensions/core/array.rb
erp_base_erp_svcs-3.0.4 lib/erp_base_erp_svcs/extensions/core/array.rb
erp_base_erp_svcs-3.0.3 lib/erp_base_erp_svcs/extensions/core/array.rb
erp_base_erp_svcs-3.0.2 lib/erp_base_erp_svcs/extensions/core/array.rb
erp_base_erp_svcs-3.0.1 lib/erp_base_erp_svcs/extensions/core/array.rb
erp_base_erp_svcs-3.0.0 lib/erp_base_erp_svcs/extensions/core/array.rb