Module: Declarative::DeepDup
- Defined in:
- lib/declarative/deep_dup.rb
Class Method Summary collapse
Class Method Details
.call(args) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/declarative/deep_dup.rb', line 5 def self.call(args) case args when Array Array[*dup_items(args)] when ::Hash ::Hash[dup_items(args)] else args end end |
.dup_items(arr) ⇒ Object
17 18 19 |
# File 'lib/declarative/deep_dup.rb', line 17 def self.dup_items(arr) arr.to_a.collect { |v| call(v) } end |