lib/lutaml/model/xml_mapping_rule.rb in lutaml-model-0.1.0 vs lib/lutaml/model/xml_mapping_rule.rb in lutaml-model-0.2.1
- old
+ new
@@ -4,13 +4,37 @@
module Lutaml
module Model
class XmlMappingRule < MappingRule
attr_reader :namespace, :prefix
- def initialize(name, to:, render_nil: false, with: {}, delegate: nil, namespace: nil, prefix: nil)
- super(name, to: to, render_nil: render_nil, with: with, delegate: delegate)
- @namespace = namespace
+ # rubocop:disable Metrics/MethodLength
+ # rubocop:disable Metrics/ParameterLists
+ def initialize(
+ name,
+ to:,
+ render_nil: false,
+ with: {},
+ delegate: nil,
+ namespace: nil,
+ prefix: nil
+ )
+ super(
+ name,
+ to: to,
+ render_nil: render_nil,
+ with: with,
+ delegate: delegate
+ )
+
+ @namespace = if namespace.to_s == "inherit"
+ # we are using inherit_namespace in xml builder by
+ # default so no need to do anything here.
+ else
+ namespace
+ end
@prefix = prefix
end
+ # rubocop:enable Metrics/MethodLength
+ # rubocop:enable Metrics/ParameterLists
end
end
end