projectsimulator 0.3.2 → 0.3.3

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
  SHA256:
3
- metadata.gz: 74f715665b457881348502fb3cc58e1103faa8408b2e2e75d0d9f84eaade8020
4
- data.tar.gz: 0b8e799a7f519c100763d78599b4971b4974bbad6e6df14e1d3d7b0f01b60248
3
+ metadata.gz: 850c1d323a1816a344d896177412330258c4b9bcbe8c946182701533efdddf05
4
+ data.tar.gz: 9e7a2e6ab061f4820207085240a52d8bd36847e57b6ef5d8cf0a625739802dad
5
5
  SHA512:
6
- metadata.gz: 99827c8f22a234833341f5a466f006d83d5f369cbaca01fe6420e2911dc78dd564b480e428b2c70e8ad265b37516bc155b8ced72257a0d742d94921a023e4a3e
7
- data.tar.gz: fc4e4e4ab3f71273763094f04bf777c98fbf02c57cad03a9ce3af090783e171a2346f3c46d6038b5cd084fef66bb157fc5409861ffc90406f4aa43f68d9d0779
6
+ metadata.gz: e52e950765845719638554324e058fdda5484feb34128aad13b76f8ff0623b5db4af437aaf60778e6b2356edb43533347831e7a78c3269500f61be6183946ca0
7
+ data.tar.gz: 55d386d448cd8edb318f938771505d2d61155d7106ebf48932469ffab840db66de019a0556bfe481206af055668326e111cfc04f50346aef7f48a16ac5b80740
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -21,10 +21,28 @@ module ProjectSimulator
21
21
  if obj then
22
22
 
23
23
  s = obj.strip
24
+
25
+ puts 's: ' + s.inspect if @debug
26
+
24
27
  if s[0] == '<' or s.lines[1][0..1] == ' ' then
25
- @ed = EasyDom.new(s)
28
+
29
+ puts 'before easydom' if @debug
30
+
31
+ s2 = if s.lines[1][0..1] == ' ' then
32
+
33
+ lines = s.lines.map do |line|
34
+ line.sub(/(\w+) +is +(\w+)$/) {|x| "#{$1} {switch: #{$2}}" }
35
+ end
36
+
37
+ lines.join
38
+
39
+ else
40
+ s
41
+ end
42
+
43
+ @ed = EasyDom.new(s2)
26
44
  else
27
- build(obj, root: root)
45
+ build(s, root: root)
28
46
  end
29
47
 
30
48
  end
@@ -104,8 +122,30 @@ module ProjectSimulator
104
122
 
105
123
  end
106
124
 
107
- def to_sliml()
108
- @ed.to_sliml
125
+ def to_sliml(level: 0)
126
+
127
+ s = @ed.to_sliml
128
+
129
+ return s if level.to_i > 0
130
+
131
+ lines = s.lines.map do |line|
132
+
133
+ line.sub(/\{[^\}]+\}/) do |x|
134
+
135
+ a = x.scan(/\w+: +[^ ]+/)
136
+ if a.length == 1 and x[/switch:/] then
137
+
138
+ val = x[/(?<=switch: ) *["']([^"']+)/,1]
139
+ 'is ' + val
140
+ else
141
+ x
142
+ end
143
+
144
+ end
145
+ end
146
+
147
+ lines.join
148
+
109
149
  end
110
150
 
111
151
  def to_xml(options=nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: projectsimulator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file