roundtrip_xml 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/roundtrip_xml/extractor.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9ea3907395082b36dd7afbf113a44f6d299a90a
|
4
|
+
data.tar.gz: d3f75c78a60b4cc3b8267cc04e2b9bed00cfdb18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 431571069c490b1da1a1b3e177346edc8105057a61d98cfc0c23fb4b754dbbd050794f07294294c20b05275c5f622e4c8e8efcfd489d310c7d1731315f46cc67
|
7
|
+
data.tar.gz: 45743edbd50188c1b91f09fd01e93c3c264909e9eb21b218ddb25a4368785abd537c86171ec7747906e22a942f5055fdbf047362ea5f2fa18a84ed564fcd721c
|
@@ -88,6 +88,7 @@ class Extractor
|
|
88
88
|
|
89
89
|
def convert_roxml_obj (obj)
|
90
90
|
name = obj.class.class_name
|
91
|
+
old_metadata = obj._metadata
|
91
92
|
defs = @definitions[name]
|
92
93
|
|
93
94
|
defs.each do |defin|
|
@@ -101,6 +102,7 @@ class Extractor
|
|
101
102
|
end
|
102
103
|
set_attributes new_obj, param_values
|
103
104
|
# return convert_roxml_obj new_obj
|
105
|
+
add_old_metadata new_obj, old_metadata, defin._metadata
|
104
106
|
obj = new_obj
|
105
107
|
end
|
106
108
|
end if defs
|
@@ -118,6 +120,18 @@ class Extractor
|
|
118
120
|
obj
|
119
121
|
end
|
120
122
|
|
123
|
+
def add_old_metadata(obj, old_metadata, current_metadata)
|
124
|
+
# only keep the keys that don't exist in the template's metadata (current)
|
125
|
+
# that metadata will be availabled when evaluate the roxml object
|
126
|
+
# obj._metadata = old_metadata.merge current_metadata
|
127
|
+
diff_keys = old_metadata.keys.inject([]) do |out, key|
|
128
|
+
out << key unless current_metadata.key? key
|
129
|
+
out
|
130
|
+
end
|
131
|
+
new_metadata = old_metadata.delete_if {|k, _| !diff_keys.include? k}
|
132
|
+
obj._metadata = new_metadata
|
133
|
+
end
|
134
|
+
|
121
135
|
def interpolated_diff(diff)
|
122
136
|
diff.obj_val.is_a?(String) && diff.template_val.is_a?(Utils::UndefinedParam) && diff.template_val.original && diff.template_val.original.match(/#{Utils::UNDEFINED_PARAM}:/)
|
123
137
|
end
|