We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Previously copying a ComplianceEngine::Data object (with Marshal.dump and Marshal.load) worked, but at some point that changed. We need to
ComplianceEngine::Data
Marshal.dump
Marshal.load
The text was updated successfully, but these errors were encountered:
After some testing, it seems like calling clone on a ComplianceEngine::Data works well enough.
clone
I'm going to leave this open until we verify.
Sorry, something went wrong.
If we need to do a custom clone (or maybe intialize_copy) method, it looks like something like this should work:
intialize_copy
copy = ComplianceEngine::Data.new(*self.data.map { |_,v| v[:loader] }) (self.context_variables + self.cache_variables).each do |var| value = self.instance_variable_get(var) next if value.nil? if value.is_a?(Hash) copy.instance_variable_set(var, Marshal.load(Marshal.dump(value))) else copy.instance_variable_set(var, value.dup) end end copy
No branches or pull requests
Previously copying a
ComplianceEngine::Data
object (withMarshal.dump
andMarshal.load
) worked, but at some point that changed. We need toThe text was updated successfully, but these errors were encountered: