weblet 0.3.3 → 0.3.4

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
2
  SHA256:
3
- metadata.gz: 84328a442455cb403946363b167a422151842600101026ed880f9efa3f7bae5f
4
- data.tar.gz: eb5786ae7f0b2991b8d7b4b3475011bed15fa89641b3a0644707e2a506f9e328
3
+ metadata.gz: c38324cb006650b466537f08eb043e9fa44249e8d8046e4a05e318a12750aacc
4
+ data.tar.gz: e41b0ccb1fde8b1c318cc7cd371da07ddbc93a30d670df52af8d9cab8e7f7442
5
5
  SHA512:
6
- metadata.gz: 1bb9ecfb115c39da76cbc5b49871a8391985ec6eae1caf825b75457c65a754b36e7ed00cf38af8fcdff6a2cb0482b8634230ffca072582724d793162bb863b63
7
- data.tar.gz: 3bc984b898e9c2a4d92a9e09a37835c1cc5666f4f4c019668aab423b3b922b9d28af924b428b599d1a92ff2d7dd670f9fe8a5018d389416e00773ce215ee95b0
6
+ metadata.gz: 78f84ff8aa3bc2913fed7b1cdb037855ddec86305b5dc79a2d2fefa331cb6c21b45c4d3377c431625c4d96409edf51ffeaf8b06ebd5b25fdb1fc6cdd52003bdf
7
+ data.tar.gz: 9b694e463e7ac4e52b1c61dc9645e296eb359e35ff974362c0139a83747cb3c018f599c87100ecec0b1db09a21dbb4b72317c98ff1051c1267dad286a3808f7d
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- B����� �-J��~�v���� ���A�����%��إ:�p�b5��I3֚YC�<#Ь��i^��R�>��/��� �� ��%S�׺z҆���ƃ\�lE�����@J5vFVм�׀`�����"Q���ȅh��xNu2��go{:�jO>�/ax~�!����LRk��7JD�?�)l9�KW�� ��Ec6'Y�_^����ki�_ �u;|�"a�>x ��״�(��idk:�U�t��{��(d80UC'�=r��o�}�cI��~3nk�qbc5Z�jٜ
1
+ D��v�/�ƅ�Bw^Y�<5E��VLnK�B~��}[nI>�e1| J��$����qՕ�^���G��Ƽ�d��t#P�j���� �� C4}j��E�`X��N3���fޱ2��
2
+ �OQ�x>�0��'ՓM��.Γ(�W�Ȍ�w?�3r�O���D> �A)t�1)ԾE ��t!ݷ��-����Et�?\
data/lib/weblet.rb CHANGED
@@ -70,7 +70,7 @@ end
70
70
 
71
71
  class Weblet
72
72
 
73
- def initialize(raws, b, marker: nil, debug: false)
73
+ def initialize(raws, marker: nil, debug: false)
74
74
 
75
75
  @debug = debug
76
76
 
@@ -80,7 +80,6 @@ class Weblet
80
80
  debug: debug).to_a
81
81
  @doc = Rexle.new(obj)
82
82
  @h = scan @doc.root
83
- @b = b
84
83
 
85
84
  end
86
85
 
@@ -88,13 +87,17 @@ class Weblet
88
87
  @h
89
88
  end
90
89
 
90
+ def to_outline()
91
+ treeize(scan_h(@h))
92
+ end
93
+
91
94
  def to_xml()
92
95
  @doc.root.xml pretty: true
93
96
  end
94
97
 
95
98
  def render(*args)
96
99
 
97
- @b = args.pop if args.last.is_a? Binding
100
+ b = args.pop if args.last.is_a? Binding
98
101
 
99
102
  if args.first.is_a? String then
100
103
  path = args.first.split('/').map(&:to_sym)
@@ -115,7 +118,7 @@ class Weblet
115
118
  r = found.cdatas.join if found
116
119
  end
117
120
 
118
- eval('%Q(' + r + ')', @b) if r
121
+ eval('%Q(' + r + ')', b) if r
119
122
 
120
123
  end
121
124
 
@@ -159,4 +162,29 @@ class Weblet
159
162
  end.to_h
160
163
 
161
164
  end
165
+
166
+ def scan_h(h)
167
+
168
+ a = h.map do |key, value|
169
+ value.is_a?(Array) ? [key, scan_h(value.last)] : [key]
170
+ end
171
+
172
+ end
173
+
174
+ def treeize(a, indent=-2)
175
+
176
+ indent += 1
177
+ a.map do |x|
178
+
179
+ if x.is_a? Symbol then
180
+ (' ' * indent) + x.to_s
181
+ else
182
+ treeize(x, indent)
183
+ end
184
+
185
+ end.join("\n")
186
+
187
+ end
188
+
189
+
162
190
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weblet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  mKbvoKGru7nPXh4E/ArWQ70Yz24o3lwGZW3XLzwdLPKB8MiOOGuTARkCWFEYT5tE
36
36
  We42rjyhFeidBuSZp6/7Wwlo
37
37
  -----END CERTIFICATE-----
38
- date: 2021-04-05 00:00:00.000000000 Z
38
+ date: 2021-04-06 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rexle
metadata.gz.sig CHANGED
Binary file