add VarSet#to_h
This commit is contained in:
1 parent
7ea0721cc2
commit
b05eed36eb
2 files changed
+51
No files matched your search
@@ -121,6 +121,26 @@ module Rscons
|
||||
end
|
||||
end
|
||||
|
||||
# Return a Hash containing all variables in the VarSet.
|
||||
#
|
||||
# @since 1.8.0
|
||||
#
|
||||
# This method is not terribly efficient. It is intended to be used only by
|
||||
# debugging code to dump out a VarSet's variables.
|
||||
#
|
||||
# @return [Hash] All variables in the VarSet.
|
||||
def to_h
|
||||
result = deep_dup(@my_vars)
|
||||
@coa_vars.reduce(result) do |result, coa_vars|
|
||||
coa_vars.each_pair do |key, value|
|
||||
unless result.include?(key)
|
||||
result[key] = deep_dup(value)
|
||||
end
|
||||
end
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Move all VarSet variables into the copy-on-access list.
|
||||
|
||||
Reference in new issue
Block a user