ox 2.13.2 → 2.14.2

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.
data/lib/ox/hasattrs.rb CHANGED
@@ -13,7 +13,7 @@ module Ox
13
13
  @attributes = { } if !instance_variable_defined?(:@attributes) or @attributes.nil?
14
14
  @attributes
15
15
  end
16
-
16
+
17
17
  # Returns the value of an attribute.
18
18
  # - +attr+ [Symbol|String] attribute name or key to return the value for
19
19
  def [](attr)
@@ -27,9 +27,16 @@ module Ox
27
27
  def []=(attr, value)
28
28
  raise "argument to [] must be a Symbol or a String." unless attr.is_a?(Symbol) or attr.is_a?(String)
29
29
  @attributes = { } if !instance_variable_defined?(:@attributes) or @attributes.nil?
30
+ a_str = attr.to_s
31
+ a_sym = attr.to_sym
32
+ if @attributes.has_key?(a_str)
33
+ attr = a_str
34
+ elsif @attributes.has_key?(a_sym)
35
+ attr = a_sym
36
+ end
30
37
  @attributes[attr] = value.to_s
31
38
  end
32
-
39
+
33
40
  # Handles the 'easy' API that allows navigating a simple XML by
34
41
  # referencing attributes by name.
35
42
  # - +id+ [Symbol] element or attribute name
data/lib/ox/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Ox
3
3
  # Current version of the module.
4
- VERSION = '2.13.2'
4
+ VERSION = '2.14.2'
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.13.2
4
+ version: 2.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-05 00:00:00.000000000 Z
11
+ date: 2021-03-07 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\nOptimized
14
14
  XML (Ox), as the name implies was written to provide speed optimized\nXML handling.
@@ -76,7 +76,7 @@ homepage: http://www.ohler.com/ox
76
76
  licenses:
77
77
  - MIT
78
78
  metadata: {}
79
- post_install_message:
79
+ post_install_message:
80
80
  rdoc_options:
81
81
  - "--main"
82
82
  - README.md
@@ -98,8 +98,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  requirements: []
101
- rubygems_version: 3.1.2
102
- signing_key:
101
+ rubygems_version: 3.2.3
102
+ signing_key:
103
103
  specification_version: 4
104
104
  summary: A fast XML parser and object serializer.
105
105
  test_files: []