ox 2.9.0 → 2.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 693a38e51ce73f6ba1d09252209e4591cad455a42cf60a1f883fd7bd20bf06bc
4
- data.tar.gz: 97f767135d353480b0c56273c6f1b5829dd9960c8d0930739643a2a0b8182dc2
3
+ metadata.gz: aeeadfb226235eca22604cef667feaa8e0331bbe101596394dd9f308cc1095e4
4
+ data.tar.gz: 91ce6eac0ca75791f106246eff0456f79e21fd5782bc8cad1235b58f9639a0be
5
5
  SHA512:
6
- metadata.gz: a5cefe49cf18bc5bd7eaf3a921417f916b2cd5b900189a844e2a31788b97c625f5e2f704096225445622042b1bc157856fd3a2b51db6f868d3de49e16537cb4b
7
- data.tar.gz: 9ca097653ef960651953d3b6c8926f30a3769ee9615ecc6fcbf1721b0097604524ed2ed3cce6656eb40eda9518a64247fdadb455b0d5388fd349a49cab812718
6
+ metadata.gz: 53054044ddf3c9d7addc505391e0eb2061d1a2f73e35ca69cea7216e523ce89cce5c6ae8a0f3f836dec9c78fa17861c366d4fe627f32289fba3bc04bb4eeda6d
7
+ data.tar.gz: 560ef09372d68fdb43182a8725c80ebecbc8cc778b6b64feb1c316bff47880ea1f5be2cf45528dc6c7f6078a9ffb15c493d4f39fa416c57fb55872da9f5c203e
@@ -1,4 +1,8 @@
1
1
 
2
+ ## 2.9.1 - April 14, 2018
3
+
4
+ - `prepend_child` added by mberlanda.
5
+
2
6
  ## 2.9.0 - March 13, 2018
3
7
 
4
8
  - New builder methods for building HTML.
@@ -10,9 +10,9 @@ module Ox
10
10
  # sub elements or attributes simply by name. Repeating elements with the
11
11
  # same name can be referenced with an element count as well. A few examples
12
12
  # should explain the 'easy' API more clearly.
13
- #
13
+ #
14
14
  # *Example*
15
- #
15
+ #
16
16
  # doc = Ox.parse(%{
17
17
  # <?xml?>
18
18
  # <People>
@@ -26,7 +26,7 @@ module Ox
26
26
  # </Person>
27
27
  # </People>
28
28
  # })
29
- #
29
+ #
30
30
  # doc.People.Person.given.text
31
31
  # => "Peter"
32
32
  # doc.People.Person(1).given.text
@@ -35,7 +35,7 @@ module Ox
35
35
  # => "58"
36
36
  class Element < Node
37
37
  include HasAttrs
38
-
38
+
39
39
  # Creates a new Element with the specified name.
40
40
  # - +name+ [String] name of the Element
41
41
  def initialize(name)
@@ -44,7 +44,7 @@ module Ox
44
44
  @nodes = []
45
45
  end
46
46
  alias name value
47
-
47
+
48
48
  # Returns the Element's nodes array. These are the sub-elements of this
49
49
  # Element.
50
50
  # *return* [Array] all child Nodes.
@@ -63,6 +63,16 @@ module Ox
63
63
  self
64
64
  end
65
65
 
66
+ # Prepend a Node to the Element's nodes array. Returns the element itself
67
+ # so multiple appends can be chained together.
68
+ # - +node+ [Node] Node to prepend to the nodes array
69
+ def prepend_child(node)
70
+ raise "argument to << must be a String or Ox::Node." unless node.is_a?(String) or node.is_a?(Node)
71
+ @nodes = [] if !instance_variable_defined?(:@nodes) or @nodes.nil?
72
+ @nodes.unshift(node)
73
+ self
74
+ end
75
+
66
76
  # Returns true if this Object and other are of the same type and have the
67
77
  # equivalent value and the equivalent elements otherwise false is returned.
68
78
  # - +other+ [Object] Object compare _self_ to.
@@ -74,7 +84,7 @@ module Ox
74
84
  true
75
85
  end
76
86
  alias == eql?
77
-
87
+
78
88
  # Returns the first String in the elements nodes array or nil if there is
79
89
  # no String node.
80
90
  def text()
@@ -168,7 +178,7 @@ module Ox
168
178
  end
169
179
  found
170
180
  end
171
-
181
+
172
182
  # Handles the 'easy' API that allows navigating a simple XML by
173
183
  # referencing elements and attributes by name.
174
184
  # - +id+ [Symbol] element or attribute name
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Ox
3
3
  # Current version of the module.
4
- VERSION = '2.9.0'
4
+ VERSION = '2.9.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ox
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.0
4
+ version: 2.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-13 00:00:00.000000000 Z
11
+ date: 2018-04-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: "A fast XML parser and object serializer that uses only standard C lib.\n
14
14
  \ \nOptimized XML (Ox), as the name implies was written to provide speed