polyrex-headings 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b20a5b0ee1ab9d61cc68e275ff40499dc7399089
4
- data.tar.gz: 3eb2e1b505550d64ed92106af7712ec6d2dbb449
2
+ SHA256:
3
+ metadata.gz: 9ef8d622cae6b8fecd69ecf653ac5ab0682c178e94808d37749ed2a263f3f534
4
+ data.tar.gz: 8927856088316195c6c83a36ad0011dda78472cd91ee8c9020fcd8804eecbbdc
5
5
  SHA512:
6
- metadata.gz: d4219e47e7fe6b6710f7dc8dc1a2cc4688c7d9934652a5be5582ad57c6d164b5ebfb26399600503783b78fd9403e27905044cbdec77a777723fb35d68a29ec58
7
- data.tar.gz: 6486c87f220d4ca5bb212f02ac72c8c6e746dbcbc3aa94ebc6f69ced85a976ea38ae5d6453b2ebd6e413b35f174a42868f0b6a2216cc1fe04b074ffd54243548
6
+ metadata.gz: 3492407b37ea880d038fdb4f1bfae0de1c80b221b532d8058678f309b773f241ab697dd2ad92c4f6e31567a8a25889dad0b9e78032015de9268288fab7f616f1
7
+ data.tar.gz: 2cb84eace798bb211c5a7bb1350c5292f9a694ff5db352a4169fa1116a6451493e38d896ac2c7762ccbe3f0b840eda562f371c31a76c96f0b0f04eb703d71967
Binary file
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- �Q��vwX�?FV�:ѬI�F����m,��L]c~�w�;�I�/�.������b��L�� )�'=Y� ����(�u������i ��DA���w��*y���|����`2�o�4���6�S�6D��m�D µY�qQ��Hy:��7�Â�np I<��ԫ��G&X�-�����p�c�3��
1
+ f���Q�����J����78�]*S��
2
+ /t�jϦ�C5��;O-64*U{`]��>���)of�u��������^E�
@@ -11,8 +11,9 @@ class PolyrexHeadings
11
11
 
12
12
  attr_reader :to_polyrex, :to_px, :to_s
13
13
 
14
- def initialize(raw_s)
14
+ def initialize(raw_s, debug: false)
15
15
 
16
+ @debug = debug
16
17
  buffer, type = RXFHelper.read(raw_s)
17
18
 
18
19
  if type == :unknown and buffer.lines.length <= 1 then
@@ -83,11 +84,49 @@ class PolyrexHeadings
83
84
 
84
85
  px.parse(string, delimiter: ' # ')
85
86
 
86
- @to_polyrex = @to_px = px
87
+ @to_polyrex = @to_px = @px = px
87
88
 
88
89
  end
89
-
90
+
91
+ def to_h(symbolise: true)
92
+ build(@px.records, symbolise)
93
+ end
94
+
90
95
  private
96
+
97
+ def build(records, symbolise)
98
+
99
+ a = records.map do |record|
100
+
101
+ if @debug then
102
+ puts 'record.records: ' + record.records.inspect
103
+ puts 'record.x: ' + record.x.inspect
104
+ end
105
+
106
+ if record.records.any? then
107
+
108
+ key = symbolise ? record.x.downcase.to_sym : record.x
109
+ {key => build(record.records, symbolise)}
110
+
111
+ elsif record.x =~ /^[^:]+:\s/ then
112
+ raw_key, value = record.x.split(/:\s+/,2)
113
+ key = symbolise ? raw_key.downcase.to_sym : raw_key
114
+ {key => value}
115
+
116
+ else
117
+
118
+ record.x
119
+
120
+ end
121
+
122
+ end
123
+
124
+ puts 'a.first: ' + a.first.inspect if @debug
125
+ return a.inject({}) {|r,x| r.merge!(x)} if a.first.is_a? Hash
126
+
127
+ a
128
+
129
+ end
91
130
 
92
131
  def indent(n)
93
132
  ' ' * (n)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyrex-headings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -10,49 +10,53 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
- YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV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V1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
28
+ BgkqhkiG9w0BAQsFAAOCAYEAZk/rCYEHUPiWSMoBG97y7zBoBByXMNWNLYGwe3w/
29
+ nzw+6otk7cgQ/3miwzE2Dfz0+Y/q+ObYuDzyMbhEYZvGBHVURp+M7oRH8df8Fery
30
+ zRu1tauewT6f30qXDanh1uQfNqA1WRsal+oifghbEBqhsBcoR5XscjdvIF8vX7Kn
31
+ OEkvJhRm0Wh9PtBhpcHup3BTJxi6FrKa9M2qRewKMDNyHzxZS1N1fwL//+yShXDj
32
+ IugkkDXAckDU9LRxtGvWs/fodIj+pSO1GmfM+vtWo21bXf3oXLPi3eAGxhCTaS+A
33
+ uFMwJXcd/3uGvIyAGjSIFaTVD0J9HtRv445DJDN/00fzvObt2L7U0Fu1XPE3fonF
34
+ uzY8t3bjEky2p6KPiXZoFK8fBaQFK9xGSkEQKBOmCldaVNACqXCbL8tT43voC3Xb
35
+ 7q9m2HtS5F1VPGfES14HGW+RIHF+0IMR3k71aKfUEh0UzApGI6C8+ekwjI+Itciy
36
+ K8EgeCN0vTCVx/759i3K6q22
33
37
  -----END CERTIFICATE-----
34
- date: 2017-01-13 00:00:00.000000000 Z
38
+ date: 2020-01-01 00:00:00.000000000 Z
35
39
  dependencies:
36
40
  - !ruby/object:Gem::Dependency
37
41
  name: polyrex
38
42
  requirement: !ruby/object:Gem::Requirement
39
43
  requirements:
40
- - - "~>"
41
- - !ruby/object:Gem::Version
42
- version: '1.1'
43
44
  - - ">="
44
45
  - !ruby/object:Gem::Version
45
- version: 1.1.11
46
+ version: 1.3.0
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '1.3'
46
50
  type: :runtime
47
51
  prerelease: false
48
52
  version_requirements: !ruby/object:Gem::Requirement
49
53
  requirements:
50
- - - "~>"
51
- - !ruby/object:Gem::Version
52
- version: '1.1'
53
54
  - - ">="
54
55
  - !ruby/object:Gem::Version
55
- version: 1.1.11
56
+ version: 1.3.0
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '1.3'
56
60
  description:
57
61
  email: james@jamesrobertson.eu
58
62
  executables: []
@@ -72,15 +76,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
72
76
  requirements:
73
77
  - - ">="
74
78
  - !ruby/object:Gem::Version
75
- version: 2.1.0
79
+ version: 2.3.0
76
80
  required_rubygems_version: !ruby/object:Gem::Requirement
77
81
  requirements:
78
82
  - - ">="
79
83
  - !ruby/object:Gem::Version
80
84
  version: '0'
81
85
  requirements: []
82
- rubyforge_project:
83
- rubygems_version: 2.6.8
86
+ rubygems_version: 3.0.3
84
87
  signing_key:
85
88
  specification_version: 4
86
89
  summary: Parses a raw Polyrex document containing Markdown style headings
metadata.gz.sig CHANGED
Binary file