Sha256: b73bf4f0b99cb09e7296d3f5b350ccaf4a822b441e890f15c6c5c0141f4ec16b
Contents?: true
Size: 385 Bytes
Versions: 2
Compression:
Stored size: 385 Bytes
Contents
module Toy module Cloneable extend ActiveSupport::Concern def initialize_copy(other) instance_variables.each do |name| instance_variable_set(name, nil) end @attributes = {} other.attributes.except('id').each do |key, value| value = value.duplicable? ? value.clone : value send("#{key}=", value) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
toystore-0.13.2 | lib/toy/cloneable.rb |
toystore-0.13.1 | lib/toy/cloneable.rb |