Sha256: 9d8c5f33e011c4e54ec2438e051b72b9bedbc579238057901abc0a93de7a0286
Contents?: true
Size: 572 Bytes
Versions: 1
Compression:
Stored size: 572 Bytes
Contents
require 'securerandom' module Separatum module Processors class UuidChanger def initialize @uuid_map = {} end def call(*hashes) hashes.map(&method(:transform_hash)) end def transform_hash(h) new_h = {} h.each do |k, v| if v.is_a?(String) && v.is_uuid? unless @uuid_map[v] @uuid_map[v] = SecureRandom.uuid end new_h[k] = @uuid_map[v] else new_h[k] = v end end new_h end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
separatum-0.1.0 | lib/separatum/processors/uuid_changer.rb |