Sha256: 7aaeddb62440df1bcb9f01993b042992d167b631b44d9abfb6a0cb1694e3eff0

Contents?: true

Size: 578 Bytes

Versions: 2

Compression:

Stored size: 578 Bytes

Contents

# frozen_string_literal: true

require 'immutable_struct_ex'
require_relative 'immutable_struct_ex_redactable/configuration'
require_relative 'immutable_struct_ex_redactable/version'

module ImmutableStructExRedactable
  module_function

  def create(**hash, &block)
    config = ImmutableStructExRedactable.configure
    create_with(config, **hash, &block)
  end

  def create_with(config, **hash, &block)
    config.redacted.each do |attr|
      next unless hash.key? attr

      hash[attr] = config.redacted_label
    end

    ImmutableStructEx.new(**hash, &block)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
immutable_struct_ex_redactable-1.1.0 lib/immutable_struct_ex_redactable.rb
immutable_struct_ex_redactable-1.0.0 lib/immutable_struct_ex_redactable.rb