rowx 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/lib/rowx.rb +17 -4
  5. metadata +19 -19
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fcc3c6b542ab686d3e607840f58519d753cc0baf
4
- data.tar.gz: e0e93f028cc9a300d6c999730f487a09c295ea00
3
+ metadata.gz: 11a66d1ab3498554a5ea259a5d9f6402f9e9da2f
4
+ data.tar.gz: 5d938eaa0b08ac5b642bb6aab2260b92d1846a9d
5
5
  SHA512:
6
- metadata.gz: 5935c2e5be8f4d7b55a7adb0d4c867f3cdb730c43355c10f3b6f5fff10a79264b43f9ca51cb2147988658a8bbe9a4094d1e0a8f1a174d4d4dba8118ea6e9a27f
7
- data.tar.gz: 79231dd66abcecfed13beba1d24745d7c28611898e3b98a8657365807c64be604b29fe39d769ff64dadc5b55c8d9f9c89890bec7aeeb531439d53b52fe5ff052
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
- @to_a = ['root', {}] + [summary] + scan_records(records, level)
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.0
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
- 8ixkARkWAmV1MB4XDTE1MTIxMzE4MDQ1NVoXDTE2MTIxMjE4MDQ1NVowSDESMBAG
15
+ 8ixkARkWAmV1MB4XDTE3MDEwODE3MTM0M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sDAdBgNVHQ4EFgQU1Oj49aEhbymRP7+ikY9Z3bFYTo8wJgYDVR0RBB8w
25
25
  HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
- c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAlmUZ1ZLP
27
- 5DcJRd0qOVo585HY51GcEqR8EH2jWS+07mHUOev5Q1/z3jUXx0BZsxTUvn950AJo
28
- iVedjbypskkj3vNy9LxvdxKg0wrTvLZaifabZSNW/AOYuW/kxEX+SXqz9iVrv7L0
29
- dObnVQyB5fBF6sqC5Cy40Shhu0XfvP80RA20nXu9Z0/ou+OrKjZP9BnoUbpXfqmK
30
- tUg63PoPcUScfVBhUc0o2klkE2EGM3WJVo0m1eWlc9/D6OawDb+8fUntFJkaf0+Z
31
- zfHbPJGx3yldVRmxXp8GGIPagWAvf45DNXXjpQB0mqgcuusndaC2We8vbzzjGzQO
32
- UbqEI1/DbMhxRA==
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAYwmQAjDh
27
+ LAJ+RbcNOsr0bvlpK10isoF+cmZ3SYvEHl54x+CKh9vHz42Cku08wdSOYZE1vmhS
28
+ V5PEgbPDtBwjX731M67U8C2ZCu8syL9nJVKeR5HsRpm5doRh0ujx3b0zBissbwA9
29
+ Z8f/z5ubhWmfbYWTIJ6thw5+sCqR+fPJS18Rw+nspc4a4VM912YNDeSnsMUsj5RF
30
+ iNZkrPcI6MB0FZPbCKZgRZR11NYPRP3WiWCB8lf1Sgm0I1wdsucvaFPwqDMZ2n8D
31
+ tTW+rjyuLX3NtJ5iyGmmz/CE0gX9kWF2/5wYZ/it0UG4W9z/7Rfdke4SD00FUWVB
32
+ VqXQja9F+5d+OA==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-03-26 00:00:00.000000000 Z
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@r0bertson.co.uk
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.4.8
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