roundtrip_xml 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/roundtrip_xml/base_cleanroom.rb +4 -4
- data/lib/roundtrip_xml/root_cleanroom.rb +11 -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: 3e77511e2e2d2f257ab080cebb04b0f66ee25af7
|
4
|
+
data.tar.gz: 6a3ebee19eeffa57d16e80c18a87942d58edbfe4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd50200ff25f0195d300e5c0d25ffff38dbb7ec84ce534ab0f7bf8e3a686e09eefd58f837012f8c31a695182535956753643d2c1f7fd69db46b318fc22a6dd28
|
7
|
+
data.tar.gz: 872b94b1378169aafd2efcdb979c8649dbbc1d9530cebbef70dc57143bc7de41fdfc94babbddeae3e5757eb1543ca67ca8c26dfef9ff9dd6dac6838d6ffa7fc3
|
@@ -42,9 +42,9 @@ class BaseCleanroom
|
|
42
42
|
def expose_attr_accessors()
|
43
43
|
get_el.class.plain_accessors.each do |a|
|
44
44
|
create_method(a) do |value = nil|
|
45
|
-
if value
|
46
|
-
get_el.send("#{a}=".to_sym, value)
|
47
|
-
elsif
|
45
|
+
if !value.nil?
|
46
|
+
get_el.send("#{a}=".to_sym, value)
|
47
|
+
elsif value.nil? && show_undefined_params
|
48
48
|
return get_el.send(a) || Utils::UndefinedParam.new(a)
|
49
49
|
else
|
50
50
|
return get_el.send(a)
|
@@ -60,7 +60,7 @@ class BaseCleanroom
|
|
60
60
|
def expand(clazz, &block)
|
61
61
|
plain_accessors = @el.class.plain_accessors
|
62
62
|
@value_holder ||= {}
|
63
|
-
hash = plain_accessors.inject({}) {|h, a| h[a] = @el.send(a)
|
63
|
+
hash = plain_accessors.inject({}) {|h, a| h[a] = @el.send(a).nil? ? Utils::UndefinedParam.new(a) : @el.send(a); h}
|
64
64
|
child = @runtime.create_cleanroom(clazz, @show_undefined_params)
|
65
65
|
child.inherit_properties hash.merge(@value_holder)
|
66
66
|
|
@@ -42,6 +42,17 @@ class RootCleanroom < BaseCleanroom
|
|
42
42
|
end
|
43
43
|
expose(:define)
|
44
44
|
|
45
|
+
def apply_template(name, &block)
|
46
|
+
clazz = @runtime.fetch name
|
47
|
+
raise ArgumentError, "#{name} must extend #{get_el.class.class_name}" unless clazz.ancestors.any? {|p| p == get_el.class}
|
48
|
+
|
49
|
+
expanded_template = expand clazz, &block
|
50
|
+
|
51
|
+
@el = expanded_template
|
52
|
+
end
|
53
|
+
expose(:apply_template)
|
54
|
+
|
55
|
+
|
45
56
|
def use_file(path)
|
46
57
|
self.evaluate_file(path)
|
47
58
|
end
|