Class: Uber::InheritableAttr::Clone

Inherits:
Object
  • Object
show all
Defined in:
lib/uber/inheritable_attr.rb

Class Method Summary collapse

Class Method Details

.call(value, uncloneable = uncloneable()) ⇒ Object

The second argument allows injecting more types.



25
26
27
28
# File 'lib/uber/inheritable_attr.rb', line 25

def self.call(value, uncloneable=uncloneable())
  uncloneable.each { |klass| return value if value.kind_of?(klass) }
  value.clone
end

.uncloneableObject



30
31
32
# File 'lib/uber/inheritable_attr.rb', line 30

def self.uncloneable
  [Symbol, TrueClass, FalseClass, NilClass]
end