rexle 1.2.13 → 1.2.14

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: 0a4aceb6bd947cae15225eb68bd34057a7d3beac
4
- data.tar.gz: 95b54c1d9c10f42a6c605b4868b0793dc34f39c9
3
+ metadata.gz: 3d38c81c7a23e32c83a2cc36e7e098e8934b9dff
4
+ data.tar.gz: 04554571f03400bdf7e2bcc5b01ce90bb58c6b17
5
5
  SHA512:
6
- metadata.gz: 49d16ed9730f79d7cc2e5f8e6bf740759d9fe713418a2e998393bc509e744559e760fc9199bd0854c966447880e06f3f2bc50a506fd32a679ab1fce483a29cb4
7
- data.tar.gz: ed08f4f6c9e30958d0637da8131c40e07ff1a765b0dc5ff72807f3fc998eef565e703f3608af0f81472325e3d45eadc690af87b1c7c9e106071005a245f943a0
6
+ metadata.gz: f2f01c1d8f316f2f961213f7dc37b2e17c15441a8ee500c965fc166df12229494ace0d520c3aa8a2bb326a9ad7dadd62cfb5f360f17dd7d32d7a95596f8a1c54
7
+ data.tar.gz: ae6017e0c05458d512da3e1127d47bc5526497ef5efa6fa310abdda1d4bead09f3cbfbd28f9cb96bca5960b61772872cf8be7db1273ec85b893d5f3fa58ddc82
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -11,6 +11,8 @@ require 'cgi'
11
11
 
12
12
  # modifications:
13
13
 
14
+ # 11-Feb-2015: bug fix: add_text now adds a String to @child_elements.
15
+ # All references to @child_lookup have now been removed.
14
16
  # 08-Feb-2015: bug fix: Within method filter_xpath(), a new String is created
15
17
  # from raw_path to workaround a frozen string when slice! is called.
16
18
  # bug fix: A Rexle::Element#value will now only return an
@@ -185,7 +187,6 @@ module XMLhelper
185
187
  and not x.children.is_an_empty_string?) or x.name == 'script' then
186
188
 
187
189
  out = ["<%s>" % tag]
188
- #out << x.value unless x.value.nil? || x.value.empty?
189
190
  out << scan_print(x.children)
190
191
  out << "</%s>" % x.name
191
192
  else
@@ -232,7 +233,6 @@ module XMLhelper
232
233
 
233
234
  if x.is_a? Rexle::Element then
234
235
 
235
- #return ["<%s/>" % x.name] if x.value = ''
236
236
  a = x.attributes.to_a.map do |k,v|
237
237
  "%s='%s'" % [k,(v.is_a?(Array) ? v.join(' ') : v)]
238
238
  end
@@ -432,7 +432,7 @@ class Rexle
432
432
  elsif (fn_match and fn_match.captures.first[/^(attribute|@)/]) or fn_match.nil? then
433
433
 
434
434
  procs = {
435
- #jr061012 Array: proc {|x| block_given? ? x : x.flatten.uniq },
435
+
436
436
  Array: proc { |x|
437
437
  if block_given? then
438
438
  x.flatten(1)
@@ -633,7 +633,6 @@ class Rexle
633
633
  r = e.xpath(a_path.join('/') + raw_condition.to_s \
634
634
  + remaining_path, &blk)
635
635
  r
636
- #(r || e)
637
636
  end
638
637
 
639
638
  next if rtn_element.nil? or (rtn_element.is_a? Array and rtn_element.empty?)
@@ -721,8 +720,6 @@ class Rexle
721
720
  self.xml
722
721
  end
723
722
  end
724
-
725
- #alias add add_element
726
723
 
727
724
  def add_attribute(*x)
728
725
 
@@ -738,7 +735,8 @@ class Rexle
738
735
  end
739
736
 
740
737
  def add_text(s)
741
- self.value = (self.value || '') + s.to_s
738
+
739
+ self.child_elements << s
742
740
  self
743
741
  end
744
742
 
@@ -761,9 +759,8 @@ class Rexle
761
759
 
762
760
  def children()
763
761
 
764
- #return unless @value
765
- #r = (@value.to_s.empty? ? [] : [@value]) + @child_elements
766
762
  r = @child_elements
763
+
767
764
  def r.is_an_empty_string?()
768
765
  self.length == 1 and self.first == ''
769
766
  end
@@ -771,8 +768,6 @@ class Rexle
771
768
  return r
772
769
  end
773
770
 
774
- #alias child_elements children
775
-
776
771
  def children=(a) @child_elements = a if a.is_a? Array end
777
772
 
778
773
  def deep_clone() Rexle.new(self.xml).root end
@@ -790,7 +785,6 @@ class Rexle
790
785
  e.delete if e
791
786
  else
792
787
 
793
- #jr010215 [@child_elements, @child_lookup].each{|x| x.delete_at i} if i
794
788
  i = @child_elements.index(obj)
795
789
  [@child_elements].each{|x| x.delete_at i} if i
796
790
  end
@@ -837,7 +831,7 @@ class Rexle
837
831
  def texts()
838
832
 
839
833
  r = @child_elements.select do |x|
840
- x.respond_to? :to_s
834
+ x.is_a? String or x.is_a? Rexle::CData
841
835
  end
842
836
 
843
837
  r.map do |x|
@@ -867,20 +861,11 @@ class Rexle
867
861
 
868
862
  def value=(raw_s)
869
863
 
870
- #@value = String.new(raw_s.to_s.clone)
871
864
  val = String.new(raw_s.to_s.clone)
872
865
 
873
866
  escape_chars = %w(& &amp; < &lt; > &gt;).each_slice(2).to_a
874
867
  escape_chars.each{|x| val.gsub!(*x)}
875
- =begin
876
- a = self.parent.instance_variable_get(:@child_lookup)
877
-
878
- if a then
879
- i = a.index(a.assoc(@name))
880
- a[i][-1] = val
881
- self.parent.instance_variable_set(:@child_lookup, a)
882
- end
883
- =end
868
+
884
869
  t = val
885
870
 
886
871
  @child_elements.any? ? @child_elements[0] = t : @child_elements << t
@@ -921,7 +906,6 @@ class Rexle
921
906
  return unless i
922
907
 
923
908
  parent.child_elements.insert(i+offset, node)
924
- parent.child_lookup.insert(i+offset, [node.name, node.attributes, node.value])
925
909
 
926
910
  @doc_id = self.doc_root.object_id
927
911
  node.instance_variable_set(:@doc_id, self.doc_root.object_id)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rexle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.13
4
+ version: 1.2.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  UOGKUMV5RApHDnC0ywMYNe0HK7qMSTP5YLKs8JUjNxpc5jl8+o3D3sHkNN4DzbQm
32
32
  jVfzDZ+niKvAUA==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-02-08 00:00:00.000000000 Z
34
+ date: 2015-02-10 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rexleparser
metadata.gz.sig CHANGED
Binary file