Class: Array

Inherits:
Object show all
Defined in:
lib/aromat/dclone.rb,
lib/aromat/sym_keys.rb

Overview

Monkey-patch Array Class

Instance Method Summary collapse

Instance Method Details

#dcloneArray

Deep-Clone: Recursively clones every level of the Array.

Returns:

  • (Array)

    A copy of the original array where each element has been clone’d



26
27
28
# File 'lib/aromat/dclone.rb', line 26

def dclone
	collect { |a| a.respond_to?(:dclone) ? a.dclone : Aromat::Dclone.base_clone(a) }
end

#sym_keysArray

Symbolize Keys: Recursively symbolizes hash keys.

Returns:

  • (Array)

    A copy of the original array where each element has had its keys recursively symbolized



10
11
12
# File 'lib/aromat/sym_keys.rb', line 10

def sym_keys
	collect { |e| e.respond_to?(:sym_keys) ? e.sym_keys : e }
end