lib/lutaml/model/xml_mapping.rb in lutaml-model-0.3.2 vs lib/lutaml/model/xml_mapping.rb in lutaml-model-0.3.3
- old
+ new
@@ -7,12 +7,12 @@
:namespace_uri,
:namespace_prefix,
:mixed_content
def initialize
- @elements = []
- @attributes = []
+ @elements = {}
+ @attributes = {}
@content_mapping = nil
@mixed_content = false
end
alias mixed_content? mixed_content
@@ -45,11 +45,11 @@
namespace: (namespace_set = false
nil),
prefix: nil,
mixed: false
)
- @elements << XmlMappingRule.new(
+ @elements[name] = XmlMappingRule.new(
name,
to: to,
render_nil: render_nil,
with: with,
delegate: delegate,
@@ -68,11 +68,11 @@
delegate: nil,
namespace: (namespace_set = false
nil),
prefix: nil
)
- @attributes << XmlMappingRule.new(
+ @attributes[name] = XmlMappingRule.new(
name,
to: to,
render_nil: render_nil,
with: with,
delegate: delegate,
@@ -100,14 +100,14 @@
mixed_content: mixed,
)
end
def elements
- @elements
+ @elements.values
end
def attributes
- @attributes
+ @attributes.values
end
def content_mapping
@content_mapping
end