module Treequel::ArrayUtilities

A collection of utilities for working with Arrays.

Public Instance Methods

stringify_array( array ) click to toggle source

Return a version of the given array with any Symbols contained in it turned into Strings.

# File lib/treequel/mixins.rb, line 311
def stringify_array( array )
        return array.collect do |item|
                case item
                when Symbol
                        item.to_s
                when Array
                        stringify_array( item )
                else
                        item
                end
        end
end
symbolify_array( array ) click to toggle source

Return a version of the given array with any Strings contained in it turned into Symbols.

# File lib/treequel/mixins.rb, line 327
def symbolify_array( array )
        return array.collect do |item|
                case item
                when String
                        item.to_sym
                when Array
                        symbolify_array( item )
                else
                        item
                end
        end
end