lib/roxml/xml/references.rb in roxml-4.1.1 vs lib/roxml/xml/references.rb in roxml-4.2.0

- old
+ new

@@ -1,7 +1,5 @@ -require "rexml/xpath_parser" - module ROXML class RequiredElementMissing < ArgumentError # :nodoc: end # @@ -45,18 +43,20 @@ private def conventionize(what) convention ||= @instance.class.respond_to?(:roxml_naming_convention) && @instance.class.roxml_naming_convention if !what.blank? && convention.respond_to?(:call) - URI.unescape(convention.call(URI.escape(what, /\/|::/))) + URI.decode_www_form_component(convention.call(URI.encode_www_form_component(what))) else what end end def namespacify(what) if what.to_s.present? && opts.namespace != false && ns = [opts.namespace, @instance.class.roxml_namespace, @default_namespace].compact.map(&:to_s).first + require "rexml/xpath_parser" + parser = REXML::Parsers::XPathParser.new parsed = parser.parse what parsed.each_cons(4).with_index.each do |a,i| if a[0..2] == [:child, :qname, ""] @@ -100,10 +100,10 @@ def several? array? end def wrap(xml, opts = {:always_create => false}) - wrap_with = @auto_vals ? auto_wrapper : wrapper + wrap_with = defined?(@auto_vals) && @auto_vals ? auto_wrapper : wrapper return xml if !wrap_with || xml.name == wrap_with wraps = wrap_with.to_s.split('/') wraps.inject(xml) do |node,wrap|