class Metanorma::Utils::Namespace
Public Class Methods
new(xmldoc)
click to toggle source
# File lib/utils/image.rb, line 11 def initialize(xmldoc) @namespace = xmldoc.root.namespace end
Public Instance Methods
ns(path)
click to toggle source
# File lib/utils/image.rb, line 15 def ns(path) return path if @namespace.nil? path.gsub(%r{/([a-zA-z])}, "/xmlns:\\1") .gsub(%r{::([a-zA-z])}, "::xmlns:\\1") .gsub(%r{\[([a-zA-z][a-z0-9A-Z@/]* ?=)}, "[xmlns:\\1") .gsub(%r{\[([a-zA-z][a-z0-9A-Z@/]*\])}, "[xmlns:\\1") end