Sha256: 21e2b73a036be871d03ae829d5d585195fe07146857e28275fb3ed420c06d6d3

Contents?: true

Size: 335 Bytes

Versions: 3

Compression:

Stored size: 335 Bytes

Contents

# frozen_string_literal: true

module Declarative
  module DeepDup
    def self.call(args)
      case args
      when Array
        Array[*dup_items(args)]
      when ::Hash
        ::Hash[dup_items(args)]
      else
        args

      end
    end

    def self.dup_items(arr)
      arr.to_a.collect { |v| call(v) }
    end
  end
end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/declarative-0.0.20/lib/declarative/deep_dup.rb
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/declarative-0.0.20/lib/declarative/deep_dup.rb
declarative-0.0.20 lib/declarative/deep_dup.rb