# encoding: utf-8 module Origin module Extensions # The array module adds custom behaviour for Origin onto the Array class. module Array # Combine the two objects using the add strategy. # # @example Add the object to the array. # [ 1, 2, 3 ].__add__(4) # # @param [ Object ] object The object to add. # # @return [ Object ] The result of the add. # # @since 1.0.0 def __add__(object) object.__add_from_array__(self) end # Return the object as an array. # # @example Get the array. # [ 1, 2 ].__array__ # # @return [ Array ] self # # @since 1.0.0 def __array__; self; end # Makes a deep copy of the array, deep copying every element inside the # array. # # @example Get a deep copy of the array. # [ 1, 2, 3 ].__deep_copy__ # # @return [ Array ] The deep copy of the array. # # @since 1.0.0 def __deep_copy__ map { |value| value.__deep_copy__ } end # Evolve the array into an array of mongo friendly dates. (Times at # midnight). # # @example Evolve the array to dates. # [ Date.new(2010, 1, 1) ].__evolve_date__ # # @return [ Array