dynarex 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/dynarex.rb +15 -11
- metadata +2 -2
- 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: fa8b7da4e8d5cd1b23e6bce5d1d852b4abe26fed
|
|
4
|
+
data.tar.gz: b1b2b7004882805809d372c78b610cce6cc5ce13
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 957ba23b15ccef7e0c08bc78c7dfb2f22e769c8250c0b0b665ba1ee7c256e881f1f6774fa76be6d67f23380a0ec830a8f40829f8a7beb78811750c6875aa908e
|
|
7
|
+
data.tar.gz: a538cfac322d0bb91e679e2b2023d189ecb5d04e363e73f91a7735e24b444fbb0a84d385913fc3084587a3186cb08ca81ce759768ccad58df9197ea289388998
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
data/lib/dynarex.rb
CHANGED
|
@@ -470,21 +470,22 @@ EOF
|
|
|
470
470
|
def to_xslt(opt={})
|
|
471
471
|
|
|
472
472
|
h = {limit: -1}.merge(opt)
|
|
473
|
-
xslt_schema = @xslt_schema || self.summary[:xslt_schema]
|
|
474
|
-
raise 'to_xsl(): xslt_schema nil' unless xslt_schema
|
|
473
|
+
@xslt_schema = @xslt_schema || self.summary[:xslt_schema]
|
|
474
|
+
raise 'to_xsl(): xslt_schema nil' unless @xslt_schema
|
|
475
|
+
|
|
476
|
+
xslt = DynarexXSLT.new(schema: @schema, xslt_schema: @xslt_schema ).to_xslt
|
|
475
477
|
|
|
476
|
-
xslt = DynarexXSLT.new(schema: @schema, xslt_schema: @xslt_schema ).to_xslt
|
|
477
478
|
return xslt
|
|
478
479
|
end
|
|
479
480
|
|
|
480
481
|
def to_rss(opt={}, xslt=nil)
|
|
481
482
|
|
|
482
483
|
unless xslt then
|
|
483
|
-
|
|
484
|
+
|
|
484
485
|
h = {limit: 11}.merge(opt)
|
|
485
486
|
doc = Rexle.new(self.to_xslt)
|
|
486
|
-
|
|
487
487
|
e = doc.element('//xsl:apply-templates[2]')
|
|
488
|
+
|
|
488
489
|
order = self.order || 'descending'
|
|
489
490
|
doc2 = Rexle.new "<xsl:sort order='#{order}' data-type='number' select='@id'/>"
|
|
490
491
|
e.add doc2.root
|
|
@@ -495,22 +496,22 @@ EOF
|
|
|
495
496
|
item.delete
|
|
496
497
|
|
|
497
498
|
pubdate = @xslt_schema[/pubDate:/]
|
|
498
|
-
|
|
499
499
|
xslif = Rexle.new("<xsl:if test='position() < #{h[:limit]}'/>").root
|
|
500
500
|
|
|
501
501
|
if pubdate.nil? then
|
|
502
502
|
pubdate = Rexle.new("<pubDate><xsl:value-of select='pubDate'></xsl:value-of></pubDate>").root
|
|
503
503
|
new_item.add pubdate
|
|
504
504
|
end
|
|
505
|
-
|
|
506
|
-
xslif.add new_item
|
|
507
505
|
|
|
506
|
+
xslif.add new_item
|
|
508
507
|
e2.add xslif.root
|
|
509
508
|
xslt = doc.xml
|
|
509
|
+
|
|
510
|
+
xslt
|
|
510
511
|
end
|
|
511
512
|
|
|
512
513
|
doc = self.to_doc
|
|
513
|
-
|
|
514
|
+
|
|
514
515
|
if pubdate.nil? then
|
|
515
516
|
doc.root.xpath('records/*').each do |x|
|
|
516
517
|
raw_dt = DateTime.parse x.attributes[:created]
|
|
@@ -524,11 +525,14 @@ EOF
|
|
|
524
525
|
#xml = Rexslt.new(xslt, doc.xml).to_s
|
|
525
526
|
#=begin
|
|
526
527
|
xslt = Nokogiri::XSLT(xslt)
|
|
527
|
-
out = xslt.transform(Nokogiri::XML(doc.root.xml))
|
|
528
|
+
out = xslt.transform(Nokogiri::XML(doc.root.xml)).to_xml \
|
|
529
|
+
:save_with => Nokogiri::XML::Node::SaveOptions::NO_DECLARATION
|
|
528
530
|
#=end
|
|
529
531
|
|
|
530
532
|
#Rexle.new("<rss version='2.0'>%s</rss>" % xml).xml(pretty: true)
|
|
531
|
-
|
|
533
|
+
|
|
534
|
+
xml = Rexle.new("<rss version='2.0'>%s</rss>" % out.to_s).xml(pretty: true)
|
|
535
|
+
xml
|
|
532
536
|
end
|
|
533
537
|
|
|
534
538
|
def xpath(x)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dynarex
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.4.
|
|
4
|
+
version: 1.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Robertson
|
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
|
31
31
|
SLshUY2PSjSnVYx3Gln9vzST8CSTQPZbVpDfzbTqqAZnzqhIe2UaLbzGCMoz8kbw
|
|
32
32
|
jQ7NXbu03ZrsvQ==
|
|
33
33
|
-----END CERTIFICATE-----
|
|
34
|
-
date: 2015-02-
|
|
34
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
|
35
35
|
dependencies:
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: rexle
|
metadata.gz.sig
CHANGED
|
Binary file
|