Module: Trust::InheritableAttribute

Extended by:
ActiveSupport::Concern
Included in:
Permissions
Defined in:
lib/trust/inheritable_attribute.rb

Overview

Trust InheritableAttribute

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.deep_copy(value) ⇒ Object

:nodoc:



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/trust/inheritable_attribute.rb', line 29

def self.deep_copy( value) #:nodoc:
  if value.is_a? Hash
    Hash[*value.map{ |k,v| [self.deep_copy(k),self.deep_copy(v)] }.flatten(1)]
  elsif value.is_a? Array
    value.map{ |v| self.deep_copy(v) }
  elsif value.is_a? Symbol
    value
  else
    value.clone
  end
end