roundtrip_xml 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8be8e12666739bebd81cc31be68c2707004172cb
4
- data.tar.gz: 89c888102932ba9719a7b57a89ba58ca5c736c1d
3
+ metadata.gz: c6f9312c0f358c5e57d680d9f19cfe25667046c1
4
+ data.tar.gz: d03c4d48699d51ed0a02962f948610dd0c4e7350
5
5
  SHA512:
6
- metadata.gz: a95e401af921c46d3d7a36d8248a776230729a6b81630890c6496062e1d05431f916d89f9895e017f3abf0adb9db1496daf814c99ac919403468ab167d6afb71
7
- data.tar.gz: fd001af3052e83f90617fee528178bd6065f1b43cbafbf9716fc24e6cf3eb358c5ae57f368a249dc94b968a18ffdbd338cfeb7decb9697454110379e158d4843
6
+ metadata.gz: dd0841dd612f8ce6c81a289e5f767f78516e94f928d476bbb7480694226a1c19c7a40c0e3f01f54a7d030db594e06d076525e6994d5dfa39a7c0fecbed147450
7
+ data.tar.gz: 695dd79cc60a4d92e5810c148c4ebb790a6daaa9e94de7ff19f757f0f96d1ec0a3a3c3f375c3edd00b87eb3482337515ee06e6d63e56d3e2a35354dbdf65d864
@@ -48,14 +48,15 @@ class DslRuntime
48
48
  partitions[partition] << obj
49
49
  end
50
50
  partitions
51
- partitions.inject({}) do |out, (partition, objs)|
51
+ dsl = partitions.inject({}) do |out, (partition, objs)|
52
52
  out[partition] = write_dsl_helper roxml_root, root_method, objs
53
53
  out
54
54
  end
55
55
  else
56
- write_dsl_helper roxml_root, root_method, new_objs
56
+ dsl = write_dsl_helper roxml_root, root_method, new_objs
57
57
  end
58
58
 
59
+ dsl
59
60
  end
60
61
 
61
62
  def write_dsl_helper(root, root_method, objs)
@@ -73,14 +74,16 @@ class DslRuntime
73
74
  @classes[name] = clazz
74
75
  end
75
76
 
76
- def evaluate_file(path, root_class)
77
+ def evaluate_file(path, root_class, templates = [])
77
78
  cleanroom = RootCleanroom.new(fetch(root_class).new, self)
79
+ templates.each { |t| cleanroom.evaluate_file t }
78
80
  cleanroom.evaluate_file path
79
81
 
80
82
  end
81
83
 
82
- def evaluate_raw(dsl, root_class, &block)
84
+ def evaluate_raw(dsl, root_class, templates = [], &block)
83
85
  cleanroom = RootCleanroom.new(fetch(root_class).new, self)
86
+ templates.each { |t| cleanroom.evaluate_file t }
84
87
  if block_given?
85
88
  cleanroom.evaluate &block
86
89
  else
@@ -124,7 +127,7 @@ class DslRuntime
124
127
  def deserialize_class(node, config)
125
128
  clazz = fetch(node.name) || new_roxml_class(config[:xml_name])
126
129
  config[:attrs].each do |attr|
127
- type_is_parent = node.parentage && node.parentage.any? {|n| n.name == attr[:opts][:as]}
130
+ type_is_parent = node.parentage && (node.parentage << node).any? {|n| n.name == attr[:opts][:as]}
128
131
  if type_is_parent
129
132
  add_unprocessed_attr attr, clazz
130
133
  else
@@ -78,7 +78,8 @@ EOF
78
78
 
79
79
  sexp = Sexp.from_array s
80
80
  processor = Ruby2Ruby.new
81
- processor.process(sexp).gsub("\"", "'").gsub(/[\(\)]/, ' ')
81
+ str = processor.process(sexp)
82
+ str.gsub(/\((.*)\)/, ' \\1').gsub(/"([^'\n]+)"/, "'\\1'")
82
83
  end
83
84
 
84
85
  def write_full_dsl(root_method)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roundtrip_xml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Usick