ensure copy exists on DataStore too
parent
505810ffd6
commit
1d376c78e2
|
@ -275,6 +275,18 @@ class DataStore < Hash
|
|||
list.each(&block)
|
||||
end
|
||||
|
||||
#
|
||||
# Return a deep copy of this datastore.
|
||||
#
|
||||
def copy
|
||||
clone = self.class.new
|
||||
self.keys.each do |k|
|
||||
clone.import_option(k, self[k].kind_of?(String) ? self[k].dup : self[k], @imported[k], @imported_by[k])
|
||||
end
|
||||
clone.aliases = self.aliases.dup
|
||||
clone
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue