dynarex 1.2.56 → 1.2.57
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/dynarex.rb +28 -16
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d42eb9a5d0717deaab404e5de5a46aba88618505
|
4
|
+
data.tar.gz: 43258f7e46ec208c9987ad051855b030c34846e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c758ffd422a1b382e945b458d74785db9b1daf173eb2f75bcb02044d47dd8d9b02783ccd85cbab8e18061682383f658583daac295819c43bd55d95d2015efa7
|
7
|
+
data.tar.gz: ff5a7cfe62dd3244cd1cd91c30bae062a8e548a54b4eb4d1a61ff817ef9f1d7ec51666aaf349e33335dabdd74e5d6f64383c3d637676bd4132f94c53a797ad09
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/dynarex.rb
CHANGED
@@ -34,7 +34,7 @@ class Dynarex
|
|
34
34
|
|
35
35
|
def initialize(location=nil)
|
36
36
|
#puts Rexle.version
|
37
|
-
@delimiter = '
|
37
|
+
@delimiter = ''
|
38
38
|
open(location) if location
|
39
39
|
if @order == 'descending' then
|
40
40
|
@records = records_to_h(:descending)
|
@@ -50,7 +50,15 @@ class Dynarex
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def delimiter=(separator)
|
53
|
+
|
53
54
|
@delimiter = separator
|
55
|
+
|
56
|
+
if separator.length > 0 then
|
57
|
+
@summary[:delimiter]
|
58
|
+
else
|
59
|
+
@summary.delete :delimiter
|
60
|
+
end
|
61
|
+
|
54
62
|
@format_mask = @format_mask.to_s.gsub(/\s/, separator)
|
55
63
|
@summary[:format_mask] = @format_mask
|
56
64
|
end
|
@@ -182,6 +190,19 @@ EOF
|
|
182
190
|
self.summary[x]}.join("\n")
|
183
191
|
end
|
184
192
|
|
193
|
+
if @raw_header then
|
194
|
+
declaration = @raw_header
|
195
|
+
else
|
196
|
+
smry_fields = %i(schema)
|
197
|
+
smry_fields << :delimiter if self.delimiter.length > 0
|
198
|
+
s = smry_fields.map {|x| "%s=\"%s\"" % [x, self.send(x)]}.join ' '
|
199
|
+
#declaration = "<?dynarex %s ?>" % s
|
200
|
+
declaration = %Q(<?dynarex %s format_mask="%s"?>\n) %
|
201
|
+
[s, self.format_mask.gsub('"', '\"')]
|
202
|
+
end
|
203
|
+
|
204
|
+
header = declaration + sumry
|
205
|
+
|
185
206
|
if self.summary[:rawdoc_type] == 'rowx' then
|
186
207
|
a = self.fields.map do |field|
|
187
208
|
"<xsl:if test=\"%s != ''\">
|
@@ -195,17 +216,14 @@ EOF
|
|
195
216
|
xslt = Nokogiri::XSLT(xsl_buffer)
|
196
217
|
out = xslt.transform(Nokogiri::XML(@doc.to_s))
|
197
218
|
|
198
|
-
|
199
|
-
declaration = @raw_header
|
200
|
-
else
|
201
|
-
declaration = %Q(<?dynarex schema="%s"?>\n) % self.schema.gsub('"', '\"')
|
202
|
-
end
|
203
|
-
declaration + sumry + "\n--+\n" + out.text
|
219
|
+
header + "\n--+\n" + out.text
|
204
220
|
|
205
221
|
elsif self.delimiter.length > 0 then
|
222
|
+
|
206
223
|
tfo = TableFormatter.new border: false, nowrap: true, divider: self.delimiter
|
207
|
-
tfo.source = self.to_h.map{|x| x.values}
|
208
|
-
tfo.display
|
224
|
+
tfo.source = self.to_h.map{|x| x.values}
|
225
|
+
header + tfo.display
|
226
|
+
|
209
227
|
else
|
210
228
|
|
211
229
|
format_mask = self.format_mask
|
@@ -217,13 +235,7 @@ EOF
|
|
217
235
|
xslt = Nokogiri::XSLT(xsl_buffer)
|
218
236
|
|
219
237
|
out = xslt.transform(Nokogiri::XML(@doc.to_s))
|
220
|
-
|
221
|
-
declaration = @raw_header
|
222
|
-
else
|
223
|
-
declaration = %Q(<?dynarex schema="%s" format_mask="%s"?>\n) %
|
224
|
-
[self.schema, self.format_mask.gsub('"', '\"')]
|
225
|
-
end
|
226
|
-
declaration + sumry + "\n" + out.text
|
238
|
+
header + "\n" + out.text
|
227
239
|
end
|
228
240
|
|
229
241
|
#xsl_buffer.sub!(/\[!regex_values\]/, xslt_format)
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|