jsmenubuilder 0.2.5 → 0.2.6

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: cd088f59192e4bf7f4894485a9abdce538409e1db58eb736656a612eaf812a34
4
- data.tar.gz: b637be543c6dd3be4c4913c5ca51971ac151b63c4c3fa61ad3fe6d80c5b98096
3
+ metadata.gz: 81612c62821ddc1ddf7d05efecc0c4d65fc4014857011189e77afabaf02ccc47
4
+ data.tar.gz: 83d8aa800e06745168536df31802c1ef94f88bed3f03a6c926a62bb7bc98cac5
5
5
  SHA512:
6
- metadata.gz: a88af46d247bf2b04f7168e62f9fc3950c1f0b6a35678c8439c104d091ee5b2f90121384d3110ac550828264ece21502648c431dbef9f2b06fdfd87b6a995a4b
7
- data.tar.gz: 84f42dfdb33747f4720e42f0bc0c651b19205c550455507f0a6ad36c29155f5e3fde45ddce62f54a1b5955daac678025a2383a0e25465281554f2c77c333230f
6
+ metadata.gz: d048898e0197f9a152616e0b45e4d24835ecad556540e5bdace762197c5d8a8faa4b15cc8b89860212f7097bf0fe1a625111124569858f6afb2391fe56c02dfd
7
+ data.tar.gz: 98e9424d639a8d0ce808b6909d478ea6d67112de28daf6206d4b988a4e4b9f97358188e5348b8446209fdb4c41f86f7199d362b6831cc9817e454fa90641c46c
checksums.yaml.gz.sig CHANGED
@@ -1 +1 @@
1
- \�EM��N=�J/!�Drѐ$,XO��A�Q������g�=y�7G��9�"�ԛP��淕���̶(��+%�kr��k��}GL�g�F�ۇ|B����%d�f�`� �ߒ�����'X�ȑi���Ea�D�*�Kn��O���je�)�HȽrܧ���J������˝_*�]��G��zH�O����.����բn,W6���8�~/p���X������$�ē]��2���k@ Z.�\^o�(��o>����s¶ >𬆳��)]ZSʃ�@ӯ$��2;S��+�`K�f{F\Մ:��?t����P��^�S�����`G��D�_��h���>�,��8#f�l0u���*V�w7I>��[bU�h)�����]{�U
1
+ ��$����"���e%e�ڌ������;A�>����ņe<h:$<y:10 ������9h$�����T3%�`]��tB3�Єn
data/lib/jsmenubuilder.rb CHANGED
@@ -198,13 +198,25 @@ EOF
198
198
 
199
199
  def initialize(unknown=nil, options={})
200
200
 
201
- if unknown.is_a? String or unknown.is_a? Symbol then
201
+ @debug = options[:debug]
202
+ puts 'options: ' + options.inspect if @debug
203
+
204
+ if unknown.is_a? Symbol
202
205
  type = unknown.to_sym
206
+
207
+ elsif unknown.is_a? String then
208
+
209
+ s, _ = RXFHelper.read unknown
210
+ if s =~ /^<tags/ then
211
+ options = parse_xml(s)
212
+ type = options.keys.first
213
+ else
214
+ type = unknown.to_sym
215
+ end
216
+
203
217
  elsif unknown.is_a? Hash
204
218
  options = unknown
205
- end
206
-
207
- @debug = options[:debug]
219
+ end
208
220
 
209
221
  @types = %i(tabs full_page_tabs accordion)
210
222
 
@@ -312,6 +324,18 @@ EOF
312
324
 
313
325
  end
314
326
 
327
+ def build_h(doc)
328
+
329
+ puts 'inside build_h'.info if @debug
330
+
331
+ h = doc.root.xpath('tag').inject({}) do |r,e|
332
+ r.merge(e.attributes[:title] => e.children.join.strip)
333
+ end
334
+
335
+ {doc.root.attributes[:mode].to_s.to_sym => h}
336
+
337
+ end
338
+
315
339
  def build_xml(type, opt={})
316
340
 
317
341
  puts 'inside build_xml'.info if @debug
@@ -350,6 +374,11 @@ EOF
350
374
  return doc.xml(pretty: true)
351
375
 
352
376
  end
377
+
378
+ def parse_xml(s)
379
+ doc = Rexle.new(s)
380
+ build_h(doc)
381
+ end
353
382
 
354
383
  def tabs(opt={})
355
384
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsmenubuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  haYJPATx3zs+9jtQoiFg+keM0CPYk/5LgCv9jxxzQcSS20C8O9MWRVvYfIr47ak7
36
36
  yXrDPmRvbJLTNjDv6Tkg3vU6
37
37
  -----END CERTIFICATE-----
38
- date: 2019-09-23 00:00:00.000000000 Z
38
+ date: 2019-09-28 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rexle
metadata.gz.sig CHANGED
Binary file