rowx 0.5.0 → 0.5.1
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/rowx.rb +17 -4
- metadata +19 -19
- 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: 11a66d1ab3498554a5ea259a5d9f6402f9e9da2f
|
4
|
+
data.tar.gz: 5d938eaa0b08ac5b642bb6aab2260b92d1846a9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae48e18cf88a93719057be77d5c69574310f858fb51a84a771516068d828183e206687e16054f1ae9ed49bec6a39f0454396da066c92ec0c121bd58dbd07b25d
|
7
|
+
data.tar.gz: 8ab04f916ffed593e462a1a9d4a394f5e05716485cb322cfa90c9b7411708634e69b411f9508648460b68391d95b423baea8f362993b86b899af2825e282276a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/rowx.rb
CHANGED
@@ -2,9 +2,17 @@
|
|
2
2
|
|
3
3
|
# file: rowx.rb
|
4
4
|
|
5
|
-
require 'line-tree'
|
5
|
+
#require 'line-tree'
|
6
|
+
require 'requestor'
|
6
7
|
|
8
|
+
code = Requestor.read('http://rorbuilder.info/r/ruby') do |x|
|
9
|
+
x.require 'line-tree'
|
10
|
+
end
|
11
|
+
|
12
|
+
eval code
|
7
13
|
|
14
|
+
# for an example of ArrayCollate
|
15
|
+
# see http://www.jamesrobertson.eu/snippets/2014/jun/08/collating-items-in-an-array.html
|
8
16
|
|
9
17
|
module ArrayCollate
|
10
18
|
refine Array do
|
@@ -27,7 +35,7 @@ class RowX
|
|
27
35
|
|
28
36
|
using ArrayCollate
|
29
37
|
|
30
|
-
attr_reader :to_a, :to_xml
|
38
|
+
attr_reader :to_a, :to_xml, :to_lines
|
31
39
|
|
32
40
|
def initialize(txt, level: nil)
|
33
41
|
|
@@ -47,17 +55,22 @@ class RowX
|
|
47
55
|
end
|
48
56
|
|
49
57
|
keyfield = a[0][0][/\w+/] if i == a.length - 1
|
58
|
+
|
50
59
|
i = 0 if a.flatten(1).grep(/^#{keyfield}/).length == 1 # only 1 record
|
51
60
|
records = a[i..-1].collate { |x| x.first =~ /^#{keyfield }/ }
|
52
61
|
summary = scan_a a.slice!(0,i)
|
53
62
|
|
54
63
|
summary[0] = 'summary'
|
55
64
|
|
56
|
-
@
|
57
|
-
|
65
|
+
@rexle_a = scan_records(records, level)
|
66
|
+
@to_a = ['root', {}] + [summary] + @rexle_a
|
58
67
|
@to_xml = Rexle.new(@to_a).xml pretty: true
|
59
68
|
|
60
69
|
end
|
70
|
+
|
71
|
+
def to_lines(delimiter: ' # ')
|
72
|
+
@rexle_a.map {|x| x[3..-1].map {|y| y[2]}.join(delimiter)}.join("\n").lines
|
73
|
+
end
|
61
74
|
|
62
75
|
private
|
63
76
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rowx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -12,26 +12,26 @@ cert_chain:
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
14
|
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
-
|
15
|
+
8ixkARkWAmV1MB4XDTE3MDEwODE3MTM0MloXDTE4MDEwODE3MTM0MlowSDESMBAG
|
16
16
|
A1UEAwwJZ2VtbWFzdGVyMR4wHAY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5+sCqR+fPJS18Rw+nspc4a4VM912YNDeSnsMUsj5RF
|
30
|
+
iNZkrPcI6MB0FZPbCKZgRZR11NYPRP3WiWCB8lf1Sgm0I1wdsucvaFPwqDMZ2n8D
|
31
|
+
tTW+rjyuLX3NtJ5iyGmmz/CE0gX9kWF2/5wYZ/it0UG4W9z/7Rfdke4SD00FUWVB
|
32
|
+
VqXQja9F+5d+OA==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
34
|
+
date: 2017-01-08 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: line-tree
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 0.5.6
|
56
56
|
description: Generates XML from rows of labelled text, nested text, and plain text
|
57
|
-
email: james@
|
57
|
+
email: james@jamesrobertson.eu
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.6.8
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: rowx
|
metadata.gz.sig
CHANGED
Binary file
|