csl 1.3.0 → 1.3.1

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
  SHA1:
3
- metadata.gz: f0c6bac5a4e0a88bd83e78fc8acac300a9d8a122
4
- data.tar.gz: 6cae82297a9550d275d92c8f1b86ca34b67fe181
3
+ metadata.gz: cab543528f090e62ec1de8296b73a9bed91f6753
4
+ data.tar.gz: fe30a500160c78d30915572e95a95890817b6b5a
5
5
  SHA512:
6
- metadata.gz: 27597362d702c9ff06902e59386ed237050f63aa238c336318cfc9012e7576d7e0299b6e053cbd35861799e734338e1a69eb38113149578c2f65e42999e5a2a1
7
- data.tar.gz: 42e659e3de7d61a556317178a031a0cd5b0305aa8c6c804627d40a5a4e2ecf6551f69dabdb3a3413276f649e7d7058ba5dba509a531d6fa34b7aa526aeb031fa
6
+ metadata.gz: 6ed351e95b6bf9fdd3c38199f2197c9c6c3140ce1b5ad78e7da38be7b7f483c517d63b40acae8967dcfee622ed8cca34072628d75de1f1201a71c7106e9265f4
7
+ data.tar.gz: e1c5ac96e6826f0178f34dc6dcfeb1b0a112e6b3011dc7925c61ae86954aff362bf924c586e2ea5947722f754aedf3fff3b0ab6b91775a32b00b711613617f85
@@ -474,11 +474,12 @@ module CSL
474
474
  attribute?(:'quotes') && !!(attributes[:'quotes'].to_s =~ /^true$/i)
475
475
  end
476
476
 
477
+
477
478
  def <=>(other)
478
479
  return nil unless other.is_a?(Node)
479
- return 1 if other.textnode?
480
-
481
- [nodename, attributes, children] <=> [other.nodename, other.attributes, other.children]
480
+ comparables <=> other.comparables
481
+ rescue
482
+ nil
482
483
  end
483
484
 
484
485
  # Returns the node' XML tags (including attribute assignments) as an
@@ -511,6 +512,18 @@ module CSL
511
512
  def match_conditions
512
513
  end
513
514
 
515
+ def comparables
516
+ c = []
517
+
518
+ c << nodename
519
+ c << attributes
520
+
521
+ c << (textnode? ? text : '')
522
+ c << (has_children? ? children : [])
523
+
524
+ c
525
+ end
526
+
514
527
  private
515
528
 
516
529
  def attribute_assignments
@@ -604,13 +617,6 @@ module CSL
604
617
  ["<#{attribute_assignments.unshift(nodename).join(' ')}>#{to_s}</#{nodename}>"]
605
618
  end
606
619
 
607
- def <=>(other)
608
- return nil unless other.is_a?(Node)
609
- return -1 unless other.textnode?
610
-
611
- [nodename, attributes, text] <=> [other.nodename, other.attributes, other.text]
612
- end
613
-
614
620
  def inspect
615
621
  "#<#{[self.class.name, text.inspect, *attribute_assignments].join(' ')}>"
616
622
  end
@@ -1,3 +1,3 @@
1
1
  module CSL
2
- VERSION = '1.3.0'.freeze
2
+ VERSION = '1.3.1'.freeze
3
3
  end
@@ -207,11 +207,11 @@ module CSL
207
207
  n1.children[0][:foo] = 'bar'
208
208
  expect(n1).to eq(n2)
209
209
  end
210
+
210
211
  end
211
212
  end
212
213
 
213
214
  describe TextNode do
214
-
215
215
  it { is_expected.not_to be nil }
216
216
  it { is_expected.not_to have_children }
217
217
  it { is_expected.to have_attributes(:attributes => {}) }
@@ -267,11 +267,6 @@ module CSL
267
267
  n2.text = 'foo'
268
268
  expect(n1).to eq(n2)
269
269
  end
270
-
271
- it 'text nodes are less than other nodes' do
272
- expect(TextNode.new).to be < Node.new
273
- expect(Node.new).not_to be < TextNode.new
274
- end
275
270
  end
276
271
  end
277
272
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvester Keil